Forum Discussion

HaroldR's avatar
HaroldR
Contributor
7 years ago

Change teststep request status from groovy script

Hello all the community,

I try to change the status and the colour of my teststep request, but the status of the request is not updated.

Here is my code :

import com.eviware.soapui.model.testsuite.TestStepResult.TestStepStatus;
import java.util.regex.Pattern;
import java.util.regex.Matcher; 


Pattern myRegularExpression = ~'\\w{10}'; //Create regular expression to compare to testcase property
String myProperty = testRunner.testCase.getPropertyValue("MyProperty"); // get testcaseproperty
myTestStepResult = testRunner.runTestStepByName("CheckSdcAuthorisation[8.2]"); //allow testRunner object to run teststep
myStatus = myTestStepResult.status; // def teststep status 
boolean result = myProperty.matches(myRegularExpression); //assert that string property contain the regular expression
if(result == true)
{
	statusOK = myStatus.OK; //change test step status to OK
}
else
{
	statusFAILED = myStatus.FAILED; //change test step status to failed 
}
log.info(result)

But when the execution flow cross the if statement, the status is not updated.

Anyone get an idea of how to do the trick?

2 Replies

    • HaroldR's avatar
      HaroldR
      Contributor

      Thanks for the reply, 

      The thing is, as I have a loop in my testcase, if the script failed at least once, the execution of the testcase will stop. That's why I was looking for a way to directly set an assertion to Failed and to pursue remaining executions even if one had failed before.

      So, do you get an idea of how could I change the statut of any assertion which is set in the teststep request?

      Regards,

      H.R