Can Soapui free edition assert between outputs from two requests? I want to check if a value from a output is equal to value from another output.
+1
A:
Hi Eduardo,
Yes you can! :-)
Here's a Groovy script that works in my soapUI v2.5.2 (it's pro but this works in free version as well):
def r1 = context.testCase.testSteps["Request #1"].properties["Response"]
def response1 = r1["value"]
def r2 = context.testCase.testSteps["Request #2"].properties["Response"]
def response2 = r2["value"]
log.info "Request #1 response: $response1"
log.info "Request #2 response: $response2"
assert response1 == response2
I hope this works for you too.
Cheers!
Shonzilla
Shonzilla
2009-06-16 10:32:40
+1
A:
Another that worked:
def myContext1 = new com.eviware.soapui.support.GroovyUtils( context )
holderOpConfirmation = myContext1.getXmlHolder ("opConfirmation3 - Request 2#Response")
holderOpConfirmation.namespaces["bilhete"] = "http://bilhete.ic.cp.fujitsu"
def ticketNo1 = holderOpConfirmation[ "//bilhete:ticketNo//bilhete:number" ]
log.info "ticketNo1: $ticketNo1"
//Segundo Bilhete
def myContext2 = new com.eviware.soapui.support.GroovyUtils( context )
holderGetNullifiedTickets = myContext2.getXmlHolder ("getNullifiedTickets - Request 1#Response")
holderGetNullifiedTickets.namespaces["bilhete"] = "http://bilhete.ic.cp.fujitsu"
def ticketNo2 = holderGetNullifiedTickets[ "//bilhete:getNullifiedTicketsReturn" ]
log.info "Numero bilhete 2: $ticketNo2"
if (!ticketNo2.contains(ticketNo1)) {
com.eviware.soapui.support.UISupport.showInfoMessage(
"O bilhete " + ticketNo1 + " nao se encontra entre os bilhetes anulados manualmente.\n" +
"Por favor verifique a data do relatorio nas propriedades do teste");
}
// Garantir que a data de "getNullifiedTickets - Request 1" é um dia anterior à data da volta do askPlaces original
assert ticketNo2.contains(ticketNo1)
Eduardo Santa
2009-10-29 11:03:43
+1 for following up almost seven months later!
Lord Torgamus
2010-03-15 15:18:55