问题
We have already automated scenarios using python scripts(.py
). We would like to execute these scripts in Robot Framework. Is there any option to execute Python script in RF.
Could any one please suggest me here.
回答1:
You can use the run_process keyword from the process library. It returns an object that has the status code, stdout and stderr.
For example, this runs the script /tmp/helloworld.py:
# example.robot
*** Settings ***
| Library | Process
*** Test Cases ***
| Example of running a python script
| | ${result}= | run process | python | /tmp/helloworld.py
| | Should be equal as integers | ${result.rc} | 0
| | Should be equal as strings | ${result.stdout} | hello, world
来源:https://stackoverflow.com/questions/36690705/how-to-execute-python-scripts-in-robot-framework