Forum Discussion

mrdwprice's avatar
mrdwprice
Contributor
2 years ago

Disable Response SLA assertion on all REST test steps

Hi,
Is someone able to help with a Groovy script that can be run as a Setup Script that can loop through all REST teststeps in a project and disable the Response SLA assertion

I have a starting point, but it fails with:
org.codehaus.groovy.syntax.SyntaxException: unable to resolve class RestTestRequestStep

 

 

import com.eviware.soapui.model.testsuite.*

def project = testRunner.testCase.testSuite.project

def testCase = project.testSuites["ReadyAPI_Project_Name"].testCases

testCase.each { tc ->
    tc.testSteps.each { testStep ->
        if (testStep instanceof RestTestRequestStep) {
            testStep.getAssertionList().each { assertion ->
                if (assertion instanceof RestTestRequestSlaAssertion) {
                    assertion.setEnabled(false)
                }
            }
        }
    }
}

log.info("Response SLA assertions have been disabled for all REST test steps in the 'ReadyAPI_Project_Name' project.")

 

  • As far as I can tell, "RestTestRequestStep" is not a variable / value that you can tie into by default. If you use this include statement, that should clear up the error you are seeing.

     

    import com.eviware.soapui.impl.wsdl.teststeps.RestTestRequestStep;
  • groovyguy's avatar
    groovyguy
    Community Hero

    As far as I can tell, "RestTestRequestStep" is not a variable / value that you can tie into by default. If you use this include statement, that should clear up the error you are seeing.

     

    import com.eviware.soapui.impl.wsdl.teststeps.RestTestRequestStep;