The script(Stream.py) will return exit code(1) when encountering fail case.
However, the robot framework will stop testing(no report generated) instead of showing “Fail” when getting the exit code(1) from the script.
What should I do so that the robot framework can output “Fail” when the script return exit code(1)?
OS: Windows 11
Python: 3.12.0
Robotframework: 7.0.1
From your description, the .py script throw an exception with code (1), so of course as error is in the script RF stops.
You should use a Try/Expect in your .py to catch this exception, then return something to RF.
Then when calling your script as keyword you can use a variable to get return code and use Fail keyword to stop test. Something like this:
*** Keywords ***
Stream
${statuscode} play item=rtsp
IF ${statuscode} == 1 Fail msg=yourmessage
Thank you for your reply.
Due to unexpected problem, the script will output another exit code: Process finished with exit code -1073740791 (0xC0000409) when I manually raise an exception in the .py script.
That’s why I must use “sys.exit(1)” to output the return code(1) when encountering a fail case.
Is there any way that I can avoid RF stop and it can output Fail in the situation? Thanks.