【发布时间】:2018-08-11 13:42:56
【问题描述】:
我开始学习如何使用机器人框架进行测试 我创建了以下要在本地 linux 主机上执行的测试用例。
*** Settings ***
Library Process
Suite Teardown Terminate All Processes kill=True
*** Test Cases ***
${result} = Run Process ping 1.1.1.1 -c 1 shell=True stdout=/home/user/stdout.txt
Log all output: ${result.stdout}
Should Contain ${result.stdout} 64 bytes from 1.1.1.1*
当我执行这个测试用例时,我会在终端中得到以下结果:
➜ ~ robot firstlinux.robot
==============================================================================
Firstlinux
==============================================================================
${result} = | PASS |
------------------------------------------------------------------------------
Log | FAIL |
No keyword with name 'all output: ${result.stdout}' found.
------------------------------------------------------------------------------
Should Contain | FAIL |
No keyword with name '64 bytes from 1.1.1.1*' found.
------------------------------------------------------------------------------
Firstlinux | FAIL |
3 critical tests, 1 passed, 2 failed
3 tests total, 1 passed, 2 failed
==============================================================================
Output: /home/user/output.xml
Log: /home/user/log.html
Report: /home/user/report.html
我如何让这个测试通过,我正在检查标准输出并确保它有来自 ping 命令的字符串输出,但看起来机器人没有捡起这个。我看到创建了一个 stdout.txt 文件,该文件具有来自 stdtout 的结果:
➜ ~ ping 1.1.1.1 -c 1
PING 1.1.1.1 (1.1.1.1) 56(84) bytes of data.
64 bytes from 1.1.1.1: icmp_seq=1 ttl=55 time=30.5 ms
--- 1.1.1.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 30.565/30.565/30.565/0.000 ms
如何在生成的报告中显示标准输出,目前我在报告中看不到输出。
谢谢
【问题讨论】:
标签: robotframework