使用robot跑页面自动化用例的时候,经常受到网络因素的影响而失败,这样跑一边的用例当然不是我们最终预想的,因此我们需要将失败的用例重跑,并生成报告。
网上多是修改代码来实现自动重跑,其实pybot和rebot中已经有自带重跑失败用例与合成报告的方法了。
在命令行下,直接pybot是最方便的,因此第一次用例:
call Pybot.bat -outputdir C:\WebTest\webReport\R1 C:\WebTest\web
命令pybot -help 可以查到有一个方法:

-R --rerunfailed output Select failed tests from an earlier output file to be
re-executed. Equivalent to selecting same tests
individually using --test option.
这个失败重跑输出文件路径的(英语渣)
那么重跑第一次失败的用例:
call Pybot.bat -R C:\WebTest\webReport\R1\output.xml --outputdir C:\WebTest\webReport\R2 C:\WebTest\web
重跑C:\WebTest\webReport\R1\output.xml中失败的用例,输出的路径是C:\WebTest\webReport\R2
重跑之后需要将两次跑的用例合道一个文件中

本文介绍了如何使用RobotFramework进行Web自动化测试时,如何重跑失败的测试用例并合并最终报告。通过pybot和rebot的命令行工具,可以方便地实现自动重跑失败用例并生成报告的功能。详细步骤包括查找失败用例、重新运行和合并不同运行结果,最终形成完整的测试报告。
最低0.47元/天 解锁文章
905





