Forum Discussion
JoostDG
7 years agoFrequent Contributor
Hi mgroen2,
I never really use the conditional goto step, I prefer to use the much more flexible groovy test step.
What you might look for is something like this;
def response = testRunner.testCase.getTestStepAt(context.getCurrentStepIndex()-1).testRequest.response.getResponseHeaders()
String responseStatus = response["#status#"]
//log.info responseStatus
if (!responseStatus.contains("[HTTP/1.1 2"))
{
testRunner.fail("TESTCASE: " + testRunner.getTestCase().getName() + " TESTSTEP: "+ context.getCurrentStep().getName() + " -- Resultaat van de update van de status was niet succesvol. De testcase faalt en we gaan onmiddellijk naar het einde van de status flow.")
}
This script you put in a groovy test step and it will go fetch the response status from the previous (rest request) step.
In my case: if it does NOT contain a valid http2* header status then it will fail the test case and stop execution.
Hope this helps. If it does, feel free to mark it als "resolved".
De groeten,
Joost