vd484
15 years agoOccasional Contributor
Script assertion - need help
Hello
I need some help with script assertion.
I am using a script assertion in a Test Response step and i have the below code:
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
def requestHolder = groovyUtils.getXmlHolder(messageExchange.requestContent)
def responseHolder = groovyUtils.getXmlHolder(messageExchange.responseContent)
////Data_Variables
A = "1A"
B = "1B"
for( i in ["1", "2"]){
log.info(i)
//set response variables according to product
A_Actual = responseHolder.getNodeValue(("//ns1:ABCD[1]/ns2:ABCD[1]/ns2:ABCD[1]/ns2:ABCD[1]/ns2:ABCD[1]/ns2:ABCD[1]/ns2:ABCD[1]/ns2:ABCD[XYZ]/@A").replaceAll("XYZ", i))
B_Actual = responseHolder.getNodeValue(("//ns2:ABCD[1]/ns2:ABCD[1]/ns2:ABCD[1]/ns2:ABCD[1]/ns2:ABCD[1]/ns2:ABCD[1]/ns2:ABCD[1]/ns2:ABCD[XYZ]/@B").replaceAll("XYZ", i))
assert A = A_Actual
assert B = B_Actual
}
if Assert A = A_Actual fails and Assert B = B_Actual also fails ..it only reports A failed in the request/response Output result file and does not show information that B failed.
Can you please let me know what i have to do to get all failed statements show up in the request response file.
2) question 2 - is there a way to send a string into the request/response output result file from a script assertion - using groovy code.
Appreciate your help.
Thanks
vd484
I need some help with script assertion.
I am using a script assertion in a Test Response step and i have the below code:
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
def requestHolder = groovyUtils.getXmlHolder(messageExchange.requestContent)
def responseHolder = groovyUtils.getXmlHolder(messageExchange.responseContent)
////Data_Variables
A = "1A"
B = "1B"
for( i in ["1", "2"]){
log.info(i)
//set response variables according to product
A_Actual = responseHolder.getNodeValue(("//ns1:ABCD[1]/ns2:ABCD[1]/ns2:ABCD[1]/ns2:ABCD[1]/ns2:ABCD[1]/ns2:ABCD[1]/ns2:ABCD[1]/ns2:ABCD[XYZ]/@A").replaceAll("XYZ", i))
B_Actual = responseHolder.getNodeValue(("//ns2:ABCD[1]/ns2:ABCD[1]/ns2:ABCD[1]/ns2:ABCD[1]/ns2:ABCD[1]/ns2:ABCD[1]/ns2:ABCD[1]/ns2:ABCD[XYZ]/@B").replaceAll("XYZ", i))
assert A = A_Actual
assert B = B_Actual
}
if Assert A = A_Actual fails and Assert B = B_Actual also fails ..it only reports A failed in the request/response Output result file and does not show information that B failed.
Can you please let me know what i have to do to get all failed statements show up in the request response file.
2) question 2 - is there a way to send a string into the request/response output result file from a script assertion - using groovy code.
Appreciate your help.
Thanks
vd484