How to Execute python scripts in robot framework

别等时光非礼了梦想. 提交于 2019-12-09 07:16:19

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!