masterkeedu
17 years agoOccasional Contributor
Use Groovy Test Step to Fail another step
I am running tests against a asynchronous web service. My Load test contains 7 steps.
I use some logic to run a request, and then check for a response every 2 seconds. Once a response is received I use another groovy step to examine the response and apply assertions.
My only is trouble is I would like the code below to fail an alternate step (the original request) This will make statistic gathering much easier (rather than having to compare two steps for an acurate pass:fail ratio_
I have attached a screenshot of my loadtest results. I want the two highlighted figures to belong to the same step.
I use some logic to run a request, and then check for a response every 2 seconds. Once a response is received I use another groovy step to examine the response and apply assertions.
My only is trouble is I would like the code below to fail an alternate step (the original request) This will make statistic gathering much easier (rather than having to compare two steps for an acurate pass:fail ratio_
// we have recieved SOME response, validate it is a valid one.
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context );
//log.info( groovyUtils.projectPath )
// create holder for last response and log requestId
def holder = groovyUtils.getXmlHolder( "RetrieveCLUEAuto#Response" );
holder.namespaces["ns1"] = "http://reuse.lmig.com/choicepoint/clueauto/response"
def responseStatus = holder["//ns1:Response/ResponseStatus/@Code"];
log.info(responseStatus);
//// I would like this step to fail a request step, rather than this script.
assert responseStatus == "0" : "Response Contains Error(s)!";
I have attached a screenshot of my loadtest results. I want the two highlighted figures to belong to the same step.