且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在机器人框架中执行 python 脚本

更新时间:2023-09-07 14:11:28

您可以使用 进程库中的noreferrer">run_process 关键字.它返回一个具有状态代码、stdout 和 stderr 的对象.

You can use the run_process keyword from the process library. It returns an object that has the status code, stdout and stderr.

例如,这将运行脚本/tmp/helloworld.py:

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