Rerun entire Test Suite if a Test Case Fails in Robot Framework

99封情书 提交于 2021-01-29 11:08:12

问题


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

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 .


回答1:


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.

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

You can read more about this in here 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


来源:https://stackoverflow.com/questions/65245878/rerun-entire-test-suite-if-a-test-case-fails-in-robot-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!