0

I'm trying to run python script by using OperatingSystem Library but when I execute the test, the python script fails but in Robot framework shows Passed

In Robot Framework:

*** Settings ***
Library        OperatingSystem

*** Test Cases ***

Executing Python 
    ${result}=    Run    python3 Main.py --config ./config3220.ini 
    Log To Console    ${result}  

Console:

ERROR:root:SerialClient could not be opened. Check connection
ERROR:root:Error at opening reference: Reference could not be opened. Check connection
Executing Python                                                      | PASS |
------------------------------------------------------------------------------
Example                                                               | PASS |
1 test, 1 passed, 0 failed 

Is there any way to test if the script is working correctly?

My solution was to add this line:

Should Not Contain    ${result}    Error  

but its a short-term solution

If I debug the python script without RF, I got this message see result

1 Answer 1

2

The documentation for the run keyword says:

The execution status of the command is not checked by this keyword, and it must be done separately based on the returned output.

However, there is another advice in the above documentation:

If the execution return code is needed, either Run And Return RC or Run And Return RC And Output can be used.

You need to return a value from your Main.py for this to work, of course.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.