如果机器人框架中的测试用例失败,请重新运行整个测试套件 [英] Rerun entire Test Suite if a Test Case Fails in Robot Framework

查看:75
本文介绍了如果机器人框架中的测试用例失败,请重新运行整个测试套件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果单个特殊"测试用例失败,是否可以重新运行整个测试套件".

Is there a way to rerun entire Test Suite if a single Particular test case fails .

因此,例如,包含一个测试用例的机器人代码将检查cookie值,如果cookie具有特定模式,它将继续执行其余代码,如果失败,则应重新运行整个机器人代码/测试设置并重复3次,如果三次运行的cookie值都不相同,请让其完全失败测试套件.

So for example , a Robot Code which contain a test case which will check the cookie value , if the cookie is of a particular pattern will continue execution of rest of code , if it fails it should rerun the entire Robot Code / Test Suite and repeat this 3 times , if the cookie value is not same for three runs , let it fail the test suite completely .

推荐答案

您可以运行原始测试,重新运行失败并合并两次运行的结果.如果某些测试在第一次运行中失败,然后在第二次通过中通过,您将在结果中看到这一点.

You can run original test, rerun failed and merge the results of both runs. If some tests are failed in the first run and then pass in the second, you will see that in the results.

通常需要重新执行一部分测试,例如,修复被测系统或测试中的错误后他们自己.这可以通过按名称选择测试用例来完成(--test和--suite选项),标记(--include和--exclude)或以前的状态(--rerunfailed或--rerunfailedsuites).

There is often a need to re-execute a subset of tests, for example, after fixing a bug in the system under test or in the tests themselves. This can be accomplished by selecting test cases by names (--test and --suite options), tags (--include and --exclude), or by previous status (--rerunfailed or --rerunfailedsuites).

robot --output original.xml tests                                # first execute all tests
robot --rerunfailedsuites original.xml --output rerun.xml tests  # then re-execute failing
rebot --merge original.xml rerun.xml                             # finally merge results

您可以在此处 https:/了解更多信息/robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#merging-re-executed-tests

对于您的特定示例,我不确定您可以这样做.但是您可以保存运行的退出代码并据此对其进行评估

To your specific example, I am not sure that you can do that. But you can save the exit code of the run and evaluate it base on that

robot "your robot options" $@
if [ $? -eq 0 ]; then 
"evaluation options when passed"
fi
else
"evaluation options when failed"
fi

这篇关于如果机器人框架中的测试用例失败,请重新运行整个测试套件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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