开发者社区 问答 正文

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

我们已经使用python scripts(.py)实现了自动化方案。我们想在Robot Framework中执行这些脚本。是否有任何选项可以在RF中执行Python脚本。

有人可以在这里建议我。

展开
收起
祖安文状元 2020-02-22 15:46:41 572 分享 版权
1 条回答
写回答
取消 提交回答
  • 您可以使用流程库中的run_process关键字。它返回一个具有状态代码stdout和stderr的对象。

    例如,这将运行脚本/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
    
    2020-02-22 15:46:49
    赞同 展开评论