Forum Discussion

rdebie's avatar
rdebie
Contributor
17 years ago

Disable a test step from a groovy script.

hello,

Can you tell met how i can disable one or more test steps from a groovy script.

I can see if a step is disabled by the script

testRunner.getTestCase().getTestStepByName( "Download Jira-Attachments" ).isDisabled();

But now i want to enabled/disable steps by groovy script.

Regards,

Raymond Wiertz

7 Replies

  • omatzura's avatar
    omatzura
    Super Contributor
    Hi Raymond!

    sure.. try

    testRunner.testCase.getTestStepByName( "Download Jira-Attachments" ).disabled = false

    to disable the step..

    regards!

    /Ole
    eviware.com
  • Hello Ole,

    That doesn't work well.

    I got an error

    Thu Aug 09 14:11:36 CEST 2007:ERROR:java.lang.IndexOutOfBoundsException


    regards,

    Raymond
  • omatzura's avatar
    omatzura
    Super Contributor
    Hi Raymond,

    strange.. can you show me your entire script?

    regards!

    /Ole
    eviware.com
  • omatzura's avatar
    omatzura
    Super Contributor
    Hi Raymond,

    thanks.. it's a bug that occurs when trying to enabled a teststep that is already enabled (and hasn't been disabled previously..)..

    you can work around this by first checking if it already is enabled before setting disabled to false.. ie

    def testStep = testRunner.testCase.getTestStepByName( "step 2" )
    if( testStep.disabled )
      testStep.disabled = false

    sorry for the inconvenience.. I can send you a patched jar if you want..

    regards!

    /Ole
    eviware.com
  • Hello Ole,

    Thank you for finding out the problem.

    If would appreciate it.


    regards,
    Raymond Wiertz