Ask a Question

Groovy to run a specific test step and then abort the test case

Occasional Contributor

Groovy to run a specific test step and then abort the test case

In one of my re-usable test case I have 5 steps(requests) and I want to write a groovy step (in the same test case) which should read the property and based on its value should run one of the available 5 steps and ignore rest of them.

Basically dynamically pick and run a test step and then abort the test case.


Thanks in advance for help.


def tc=testRunner.testCase.testSuite.getTestCaseByName("TestCaseName")

testRunner.cancel("just stop the testCase")
return null;


Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.Smiley Wink

Occasional Contributor

Thanks for the response but I just realized (after using your solution) that I forgot to mention that I am using a session start step before this groovy step and to run any specific test case through groovy I also have to pass on  the session.

And the problem is I am not able to pass on the session using groovy.

Here is the test case structure:

Step #1 Session Start

Step#2 Groovy to run a specific test step among next 5 steps (Test1...Test5)

Step#3 Test1

Step#4 Test2

Step#5 Test3

Step#6 Test4

Step#7 Test5

Occasional Contributor

Never Mind. I figured the way to pass on the session.

Thanks for your help though.

Showing results for 
Search instead for 
Did you mean: