jkrier
10 years agoRegular Contributor
Read Test Request assertions with Groovy script
Hello,
Does anyone know how to validate the result of any assertions set in a previous request with a Groovy script?
For example, my project makes a soap call and I have some assertions set in the Test Request for Content Match, HTTP status etc. I then want to run a Groovy step that can evaluate those assertions and make decisions based on their results.
I found a way to read the assertions but not in a way that is useful to me.
This produces
I can't find what to do next.
I've been reading lots of forums and can't seem to find anywhere where someone else has tried this before. Any help would be greatly appreciated.
Does anyone know how to validate the result of any assertions set in a previous request with a Groovy script?
For example, my project makes a soap call and I have some assertions set in the Test Request for Content Match, HTTP status etc. I then want to run a Groovy step that can evaluate those assertions and make decisions based on their results.
I found a way to read the assertions but not in a way that is useful to me.
assertList = testRunner.getTestCase().getTestStepByName("MyTestStep").getAssertionList().toString()
This produces
Wed Nov 05 13:35:36 MST 2014:INFO:[com.eviware.soapui.impl.wsdl.teststeps.assertions.ProXPathContainsAssertion@5e58e7b5, com.eviware.soapui.impl.wsdl.teststeps.assertions.ProXPathContainsAssertion@1ed44c77, com.eviware.soapui.security.assertion.ValidHttpStatusCodesAssertion@3e82871, com.eviware.soapui.security.assertion.InvalidHttpStatusCodesAssertion@7eb714b7]
I can't find what to do next.
I've been reading lots of forums and can't seem to find anywhere where someone else has tried this before. Any help would be greatly appreciated.