Forum Discussion

jmahant's avatar
jmahant
Occasional Contributor
6 years ago
Solved

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 availab...
  • ashu248's avatar
    6 years ago

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

    if(it.name.toString()=="StepName"){
    it.run(testRunner,context)
    testRunner.cancel("just stop the testCase")
    return null;
    }
    log.info(it.name)
    }

     

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