Hi. I have a need to post the RF script run result (Pass/Fail) on the SUT on an issue tracking forum. Obviously once the RF script has finished running its got no way of posting the result (and I can’t post the result until its finished!). So I have written a pretty shameful script that looks at the RF report generated then logs into the forum and posts the result, but how to get around the problem of triggering this “post to forum” script when the RF execution has finished. (the holy grail would be to post the test report at the same time but one thing at a time!)
Just wondered if I’m missing anything obvious.
(the system runs on an intranet there is no access to the web).
As always is the case in IT, there are many options and no right or wrong way, it’s really a matter of what works best for you.
Options you have (in order mentioned):
parse the robot results files (like you are doing) this is actually how I started with RFSwarm too. are you parsing the log.html or the output.xml file, the xml file is easier as you can use xml libraries to convert the xml to a dictionary that is easy to iterate.
[Pro: can use any programming language you like / Con: need to wait till after execution then run a seperate process]
As @ericbjones mentioned you can create a keyword and call it as a teardown
[Pro: same robot keywords as your test case so no need to learn anything new]
Use robot framework’s listener api to report results as they happen (this is what RFSwarm uses now)
[Pro: transparent to your test cases, so can be controlled at runtime if enabled or not, also can post passes to your issue tracker while next test continues to run / Con: need to write listeners in python or java]
There may also be other options but those are the ones I know.
Don’t be ashamed, any script that works for you is better than repetitively doing manual steps and everyone needs to start somewhere and practical exercises like this are a great way to learn programming.
*** Test Cases ***
TC1-STARTUP
[Documentation] Open Browser
[Tags] open app
Go to MyApp
[Teardown] My Teardown
TC2-TESTRESULT
[Documentation] clicks a link
[Tags] hyperlinks
Click Element my link
[Teardown] My Teardown
TC3-TESTRESULT
[Documentation] clicks another link
[Tags] hyperlinks
Click Element my other link
[Teardown] My Teardown
*** Keywords ***
My Teardown
Log ${TEST STATUS}
Run Keyword if '${TEST STATUS}' == 'FAIL' Close All Browsers