问题
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