Showing results for 
Search instead for 
Did you mean: 

Cancelling a Test Run

Occasional Contributor

Cancelling a Test Run


I currently have a test step which calls another test case. In the called test case, I have a groovy script with a conditional if statement. If a certain condition is met I want to cancel the current execution. I've added the below two lines;

testRunner.cancel("Condition not met");

What I find however, is that control is passed back to the test case in which the call was made from, and it continues to execute the remaining test steps within the case. The only way around this is to use""), but this is not really what I want.

Please can anyone advise. Many thanks.

Community Hero

Re: Cancelling a Test Run

Hi @stores80,


testRunner.cancel("Condition not met");


Above syntax you are using is alone sufficient enough to stop the execution. Try with removing return statement.


Click "Accept as Solution" if my answer has helped,
Remember to give "Kudos" 🙂 ↓↓↓↓↓

Thanks and Regards,
Himanshu Tayal

Re: Cancelling a Test Run

Hi everyone,


@HimanshuTayal thank you for the reply!


@stores80 have you had a chance to try what Himanshu suggested? If it works for you, could you please mark his reply as a Solution to this topic? It will make the search for the answer easier for other users. Thanks.



Olga Terentieva
SmartBear Assistant Community Manager

New Here?
Join us and watch the welcome video:
Top Kudoed Authors