Forum Discussion

masterkeedu's avatar
masterkeedu
Occasional Contributor
17 years ago

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_

// 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.

2 Replies

  • Hello,

    There isn't relly any way to fail a teststep after it has been completed. However, won't the count for "Assertion" always end up being the same as for "OrderCLUEAuto"?

    Regards,
    Dain
    eviware support
  • masterkeedu's avatar
    masterkeedu
    Occasional Contributor
    Dain:

    Your absolutely right(which I realized after my full first test run..silly). 

    I ended up just adding some additional logic to the assertion step to create my log/stats file. It gives me a nice consolidated picture across all seven steps.