I run tens of test suites each containing several test cases in a row. If a test case in a test suite fails I need to fail or skip all the remaining test cases in that test suite without affecting following test suites.
I am planning to use Test Setup to fail or skip the testcase if any previous test has failed by checking a suite variable which is set in Test Teardown if the testcase failed.
I’m just wondering if there is a better way to do this?
Not sure if this will help, you could try Fatal Error
It says: “The test or suite where this keyword is used fails with the provided message”
but it also says: “Stops the whole test execution.”
It seems like you want something in between Fail and Fatal Error
my other suggestion would be to use Set Suite Variable.
set a variable to false in the *** Variables *** section
in the test that the others depend on set it to true as the last line
in the other tests after this important one check if the variable is true before continuing
if it’s not one specific test but they all need to pass sequentially (I don’t remember where it is in the documentation, but it’s recommended that test cases shouldn’t be dependent on each other) you could set it to false when a test starts and back to true as the last step in the test, alternatively you could use a Test teardown to set it to false
Thank you for your response.
You’re right. Based on my experiments Fatal Error terminates the whole test execution i.e. all the following test suites will fail also. Fail keyword causes only the current test case to fail. So something between them would be perfect in my case.
I know that tests should not be dependent on each other but in my case (embedded system testing) test cases would be very big and complicated. That’s why I prefer to use test cases which sometimes are dependent on each other in a same test suite.
I will continue with suite variable based solution.