cancel
Showing results for 
Search instead for 
Did you mean: 

Disable a test step from a groovy script.

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

Hi Raymond!

sure.. try

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

to disable the step..

regards!

/Ole
eviware.com
Highlighted
Contributor

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

Hi Raymond,

strange.. can you show me your entire script?

regards!

/Ole
eviware.com
Highlighted
Contributor

Hi Ole,

I just made a simple test case.

See attachment.

Just 3 groovy test cases with log rules.

Greets,

Raymond
Highlighted
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
Highlighted
Contributor

Hello Ole,

Thank you for finding out the problem.

If would appreciate it.


regards,
Raymond Wiertz
Highlighted
Contributor

Ole,

It works fine.

Thanks.

Raymond
New Here?
Join us and watch the welcome video:
Announcements
TechCorner Leaderboard
Want a fun and easy way to learn ReadyAPI and show off your skills? Try solving weekly TechCorner challenges and get into the Leaderboard!


Challenge Status

Get a full Raw JMS request

Participate!

Compare an expected JSON value and actual response in Events

Participate!

Fetch value/data from JSON response using Groovy Script

See replies!

Get data from Petstore and add it to Excel sheets

Participate!
Top Kudoed Authors