Forum Discussion

Awesome's avatar
Awesome
Frequent Contributor
17 years ago

how do you delete a request step from groovy?

hi all,
how do you delete a request step from groovy?

i've tried the following but no luck:

request_name="the_request_name"

//testRunner.testCase.removeTestStep.getTestStepByName("the_request_name")
//testRunner.testCase.testSteps[request_name].remove
//testRunner.getTestCase().getTestStepByName().removeTestStep(request_name)


thanks

3 Replies

  • Awesome's avatar
    Awesome
    Frequent Contributor
    this didn't work either...

    def testStep = testRunner.testCase.testSteps[testStepName]
      testStep.removeTestStep();
  • Hi!

    You can use this code:


    request_name = "the_request_name"
    def testCase = testRunner.testCase
    def testStep = testCase.getTestStepByName(request_name)
    testCase.removeTestStep(testStep)


    Regards,
    Dain
    eviware.com
  • Awesome's avatar
    Awesome
    Frequent Contributor
    thanks works perfectly!

    fyi (for others): testStep will return the address of the testStep not the name.