New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suite setup and teardown are executed even if all tests are skipped #4571
Comments
Also encountered this in our test executions. This is probably not in line with the documented Skip feature behavior. If all test cases are skipped, the test suite should be skipped in the execution
|
Yeah, it's pretty stupid to run suite setup and/or teardown if all tests are unconditionally skipped. It ought to be pretty easy to check that based on tags before running the suite setup/teardown. We cannot detect would tests be skipped dynamically during execution, though. I consider this a bug and assign this to RF 6.1 milestone. I cannot promise we get it fixed already in that release, so if you consider this important take a look at creating a pull request. The reason excluding tests behaves differently is that those tests are removed from the suite altogether and suites that become empty are removed as well. When skipping tests, suites aren't empty and suite setup/teardown is run unconditionally without looking are tests skipped or not. |
Same thing happens if tests are excluded using |
Thank you @pekkaklarck for the fix! 💯 |
When all test cases in a suite are skipped because of the
--skip
command line option and a matching tag, theSuite Setup
is executed, even when no test cases in the suite are executed. If the setup fails, all test cases will get status FAIL, even tough they shall be skipped.It doesn't matter if each individual test case is tagged using
[TAGS]
or if theForce Tags
setting is used.A workaround is to use both the
--skip
and--skiponfailure
options with the same tag. The status for all the keywords will then be SKIP. However, theSuite Setup
will still be executed, which is a problem for us because the failure may leave our system in an undefined state.We have previously used the
--exclude
option. Then theSuite Setup
was not executed in the case described above. We switched to the--skip
option because we want the not executed tests to be visible in the logs.We are using Robot Framework 6.0.1.
Example:
Executing the example:
The text was updated successfully, but these errors were encountered: