Forum Discussion

pankajmalinda's avatar
Occasional Contributor
5 years ago

Groovy Script to run SOAP test step 2 times

Hi HimanshuTayal    I am trying to execute one SOAP Test step 2 times, I have below script but it seems that it's not working fine.   if( context.loopIndex == null ) context.loopIndex = 0 i...
  • HimanshuTayal's avatar
    5 years ago

    Hi pankajmalinda ,


    If the only motive of 1st groovy is to execute SOAP Step 2times then you can use below code:


    def SOAPStep = testRunner.testCase.getTestStepByName("Test Step Name");

    If yoy want to execute all below 3 steps then use below code:


    def SOAPStep = testRunner.testCase.getTestStepByName("Your Test Step Name");
    def groovyStep1 = testRunner.testCase.getTestStepByName("Your Test Step Name");
    def groovyStep2 = testRunner.testCase.getTestStepByName("Your Test Step Name");
    disableTestStep(SOAPStep, "false")
    disableTestStep(groovyStep1, "false")
    disableTestStep(groovyStep2, "false")
    disableTestStep(SOAPStep, "true")
    disableTestStep(groovyStep1, "true")
    disableTestStep(groovyStep2, "true")
    def disableTestStep(testStep, disableFlag){
    	if(disableFlag.toLowerCase() == "true"){
    		if( testStep.disabled.toString().trim() == "false" ){
    			testStep.disabled = true
    		if( testStep.disabled.toString().trim() == "true" ){
    			testStep.disabled = false