我试图了解机器人框架是如何工作的。所以我使用这两个文件做了一些测试:
• hello.py
print('Hello')
• TC_Hello.robot
*** Settings ***
Library Process
*** Test Cases ***
Example of running a python script
${result}= Run Process python D:\\RobotFrameworkTest\\Hello\\hello.py
Should be equal as strings ${result.stdout} Hello
但由于某些原因,我收到错误找不到名称为“Run Process”的关键字
。所以我检查了一下,人们似乎忘记包含该库,这不是我的情况。
有人可以帮助我吗?
--编辑
我尝试使用另一种语法运行机器人文件,由于某些原因,该语法似乎运行成功:
*** Settings ***
| Library | Process
*** Test Cases ***
| Example of running a python script
| | ${result}= | run process | python | D:\\RobotFrameworkTest\\Hello\\hello.py
| | Should be equal as strings | ${result.stdout} | Hello
但是我的雇主非常不喜欢这种语法...
最佳答案
--已解决
所以我注意到我在设置部分中的Library Process
之前放置了一个选项卡。因此,Process
从未包含在内,并且触发了错误。
这正在工作:
*** Settings ***
Library Process # No tab at the beginning here
*** Test Cases ***
Example of running a python script
${result}= Run Process python D:\\RobotFrameworkTest\\Hello\\hello.py
Should be equal as strings ${result.stdout} Hello
我觉得自己很蠢。不管怎样,谢谢你的帮助。
关于python - 机器人框架 - "No keyword with name ' 运行进程'被发现”,同时包含进程库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63575218/