cancel
Showing results for 
Search instead for 
Did you mean: 

Disable reststep via groovy

Occasional Contributor

Disable reststep via groovy

Trying to disable rest test step via groovy. but keep getting below error.

 

ERROR:Exception happened: groovy.lang.MissingMethodException: No signature of method: com.eviware.soapui.impl.wsdl.teststeps.RestTestRequestStep.isDisabled() is applicable for argument types: (java.lang.Boolean) values: [true]

Possible solutions: isDisabled(), setDisabled(boolean)

 

 

Solutions tried:

 

testRunner.testCase.getTestStepByName("mystep").setDisabled(true)
 testRunner.testCase.testSteps["mystep"].disabled = true

 def testStep = testRunner.testCase.getTestStepByName( "mystep" )
if( testStep.disabled ){

  testStep.disabled = false

}

testRunner.testCase.getTestStepByName( "mystep" ).setDisabled(true)

 

but, same error every time. is it different for rest step type?

 

 

 

25 REPLIES 25
Community Hero

Re: Disable reststep via groovy

Is it one time time task?


Regards,
Rao.
Occasional Contributor

Re: Disable reststep via groovy

No, it needs to be done repeatedly. 

I am doing data driven test and if test step passes with 1 data, then disable that step so it does not run with next data in queue.

 

Community Hero

Re: Disable reststep via groovy

It is possible to do data driven without disable also, have added a link to the sample project recently in the community.
Let me see and forward it.

However, it should disable with snippet you posted as well. A bit of strange.


Regards,
Rao.
Community Hero

Re: Disable reststep via groovy

Community Hero

Re: Disable reststep via groovy

Have tested, and both statements are working at my end.


Regards,
Rao.
Occasional Contributor

Re: Disable reststep via groovy

thank you for trying, but I keep getting this error.

 

they way i am doing is:

 

I execute suite and have another suite to print report of first suite, there i am adding mentioned groovy step and check the status of step is pass from first suite and trying to  disable it and I get this error.

 

 

Community Hero

Re: Disable reststep via groovy

Create a simple project so that issue can be reproducible and attach it.


Regards,
Rao.
Community Leader

Re: Disable reststep via groovy

@alpha123 :

 

Could you please attach image of your error and project structure, it will be helpful in identifying the issue.

 


Click "Accept as Solution" if my answer has helped,
Remember to give "Kudos" 🙂 ↓↓↓↓↓



Thanks and Regards,
Himanshu Tayal
Occasional Contributor

Re: Disable reststep via groovy

Hi Below is my project structure,

Testsuite - 1) UST1  2) Library

 

Testsuite # 1 - UST1

has two tcs inside 

Tc # 1 - UST1(disabled) - this is where all my test steps are and what gets executed evertytime, it's disabled. Steps inside are executed with "ReadInput" step in Tc # 2 - DataLoop.

Tc # 2 iterates n times and executed steps from Tc # 1 with different data. ( My goal is to only run failed step in next iteration, hence looking in to solution to disable pass steps)

 

Testsuite # 2 - Library

GenerateCSVReport - this is report generation step for testsuite # 1, I am generating teststep pass/fail report for every iteration for Tc # 1 in Testsuite # 1. 

I am adding step disable logic in here, while writing it to report, if step passes in iteration 1, disable along with report generation and that's where i get this error. ( see in red in log section)

 

image001.png

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors