Forum Discussion

alpha123's avatar
alpha123
Occasional Contributor
4 years ago

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

    • alpha123's avatar
      alpha123
      Occasional Contributor

      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.

       

      • nmrao's avatar
        nmrao
        Champion Level 3
        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.
  • nmrao's avatar
    nmrao
    Champion Level 3
    Have tested, and both statements are working at my end.
    • alpha123's avatar
      alpha123
      Occasional Contributor

      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.

       

       

      • nmrao's avatar
        nmrao
        Champion Level 3
        Create a simple project so that issue can be reproducible and attach it.
  • alpha123 :

     

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

     

    • alpha123's avatar
      alpha123
      Occasional Contributor

      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)

       

      • nmrao's avatar
        nmrao
        Champion Level 3
        Can't even see the image clearly.
        Requested for a sample project which helps to reproduce the problem.