Forum Discussion
SmartBear_Suppo
Alumni
12 years agoHi Mary,
I'm sorry to hear you're having problems. I tried to reproduce the issue with running your script as a Groovy test step, and I think I know what the problem is. The "Run TestCase" step fails correctly when the target case fails, but it doesn't log the message we want. The reason for this is that a test case, by the default, stops running and fails immediately if one of its test steps fails. Because of this, the Groovy test step at the end is never executed if a previous step fails.
Luckily, solving this is easy. Go to the target test case and open its options dialog (either right click the TestCase and select "Options" or click the options icon in the TestCase view) and uncheck the "Fail on error" checkbox. Now, the test case will continue running through its steps even after one test step fails, allowing the final Groovy script to run no matter what.
This should be a more stable way of doing this kind of assertion without having to rely on a TearDown script. I hope this helps, and if not, let me know and I'll happily assist further.
Regards,
Arian
SmartBear Sweden
I'm sorry to hear you're having problems. I tried to reproduce the issue with running your script as a Groovy test step, and I think I know what the problem is. The "Run TestCase" step fails correctly when the target case fails, but it doesn't log the message we want. The reason for this is that a test case, by the default, stops running and fails immediately if one of its test steps fails. Because of this, the Groovy test step at the end is never executed if a previous step fails.
Luckily, solving this is easy. Go to the target test case and open its options dialog (either right click the TestCase and select "Options" or click the options icon in the TestCase view) and uncheck the "Fail on error" checkbox. Now, the test case will continue running through its steps even after one test step fails, allowing the final Groovy script to run no matter what.
This should be a more stable way of doing this kind of assertion without having to rely on a TearDown script. I hope this helps, and if not, let me know and I'll happily assist further.
Regards,
Arian
SmartBear Sweden