如何在机器人框架中执行 python 脚本 [英] How to Execute python scripts in robot framework

查看:54
本文介绍了如何在机器人框架中执行 python 脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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.

推荐答案

您可以使用 进程库中的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

这篇关于如何在机器人框架中执行 python 脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆