Does anyone have a good example of testing a python program using Robot Framework.
I am trying to run my python program (chaptermarkers.py) with an argument of --test and checking the results.
Passing the argument has been an odyssey of google searches for 2 days.
[file: common_resourses.robot]
*** Settings ***
Library OperatingSystem
*** Variables ***
${CHAPTERMARKERS_EXEC} chaptermarkers
${LOG LEVEL} DEBUG
*** Keywords ***
# TODO
[Test Cases: file: default_suite.robot]
*** Settings ***
Documentation *Test Chapter Markers runs but has error in filename*
Metadata Github https://github.com/cbitterfield/chaptermarkers
Metadata Version 1.0.0
Metadata Executed At ${HOST}
# External libraries imports
Library Process
Library String
Resource common_resources.robot
*** Variables ***
${EXPECTED_MESSAGE} Movie Filename
${REPORT FILE} report.html
${LOG FILE} logfile.html
${LOG LEVEL} DEBUG
${OUTPUT DIR} /Users/colin/IdeaProjects/chaptermarkers
${test} --test
*** Test Cases ***
Scenerio test chaptermarkers run
[Tags] DEBUG
[Documentation] Verifies that chaptermarkers is executed well and without errors
${result}= Run process ${CHAPTERMARKERS_EXEC} ${test}
Should Contain ${result.stdout} ${EXPECTED_MESSAGE}
Should Be Empty ${result.stderr}
No matter how I try to put something after the program, I get an error of directory missing.
[Crazy unusable error messages]
$ robot --loglevel DEBUG --log log.html --report report.html stests/default_suite.robot
[ ERROR ] Error in file '/Users/colin/IdeaProjects/chaptermarkers/stests/default_suite.robot' on line 25: Invalid variable name '${test} --test'.
==============================================================================
Default Suite :: *Test Chapter Markers runs but has error in filename*
==============================================================================
Scenerio test chaptermarkers run :: Verifies that chaptermarkers i... | FAIL |
Variable '${test}' not found. Did you mean:
${TEST_TAGS}
${TEST_NAME}
------------------------------------------------------------------------------
Default Suite :: *Test Chapter Markers runs but has error in filen... | PASS |
0 critical tests, 0 passed, 0 failed
1 test total, 0 passed, 1 failed
==============================================================================
Output: /Users/colin/IdeaProjects/chaptermarkers/output.xml
[ ERROR ] Unexpected error: FileNotFoundError: [Errno 2] No such file or directory: '/Users/colin/IdeaProjects/chaptermarkers/env/lib/python3.8/site-packages/robot/htmldata/rebot/log.html'
Traceback (most recent call last):
File "/Users/colin/IdeaProjects/chaptermarkers/env/lib/python3.8/site-packages/robot/utils/application.py", line 83, in _execute
rc = self.main(arguments, **options)
File "/Users/colin/IdeaProjects/chaptermarkers/env/lib/python3.8/site-packages/robot/run.py", line 451, in main
writer.write_results(settings.get_rebot_settings())
File "/Users/colin/IdeaProjects/chaptermarkers/env/lib/python3.8/site-packages/robot/reporting/resultwriter.py", line 65, in write_results
self._write_log(results.js_result, settings.log, config)
File "/Users/colin/IdeaProjects/chaptermarkers/env/lib/python3.8/site-packages/robot/reporting/resultwriter.py", line 79, in _write_log
self._write('Log', LogWriter(js_result).write, path, config)
File "/Users/colin/IdeaProjects/chaptermarkers/env/lib/python3.8/site-packages/robot/reporting/resultwriter.py", line 86, in _write
writer(path, *args)
File "/Users/colin/IdeaProjects/chaptermarkers/env/lib/python3.8/site-packages/robot/reporting/logreportwriters.py", line 43, in write
self._write_file(path, config, LOG)
File "/Users/colin/IdeaProjects/chaptermarkers/env/lib/python3.8/site-packages/robot/reporting/logreportwriters.py", line 36, in _write_file
writer.write(template)
File "/Users/colin/IdeaProjects/chaptermarkers/env/lib/python3.8/site-packages/robot/htmldata/htmlfilewriter.py", line 33, in write
for line in HtmlTemplate(template):
File "/Users/colin/IdeaProjects/chaptermarkers/env/lib/python3.8/site-packages/robot/htmldata/normaltemplate.py", line 28, in __iter__
with codecs.open(self._path, encoding='UTF-8') as file:
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/codecs.py", line 905, in open
file = builtins.open(filename, mode, buffering)
(env) razzamataz:chaptermarkers colin$
question from:
https://stackoverflow.com/questions/65623690/python-tests-using-robot-framework