cancel
Showing results for 
Search instead for 
Did you mean: 

Disable a test step from a groovy script.

Contributor

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 7
Super Contributor

Re: Disable a test step from a groovy script.

Hi Raymond!

sure.. try

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

to disable the step..

regards!

/Ole
eviware.com
Contributor

Re: Disable a test step from a groovy script.

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
Super Contributor

Re: Disable a test step from a groovy script.

Hi Raymond,

strange.. can you show me your entire script?

regards!

/Ole
eviware.com
Contributor

Re: Disable a test step from a groovy script.

Hi Ole,

I just made a simple test case.

See attachment.

Just 3 groovy test cases with log rules.

Greets,

Raymond
Super Contributor

Re: Disable a test step from a groovy script.

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
Contributor

Re: Disable a test step from a groovy script.

Hello Ole,

Thank you for finding out the problem.

If would appreciate it.


regards,
Raymond Wiertz
Contributor

Re: Disable a test step from a groovy script.

Ole,

It works fine.

Thanks.

Raymond
New Here?
Join us and watch the welcome video:
Watch the New Interview
7Mistakes
Join the exciting event
SeptemberHubBub
Top Kudoed Authors
Join the September Hub-bub to show off, learn and win