Thanks, here is my project :
1) My axis service : Request : integer i => Response integer -iimport org.apache.log4j.Logger ;
public class Ping
{
private static final Logger log = Logger.getLogger(Ping.class) ;
public int ping(int val)
{ log.info("Appel de ping avec "+val) ; return -val ; }
} // End of Ping
2) The main groovy script String buildMessage(int v)
{ String res =
"
"+
""+
""+
" "+
" \n"+v+"\n"+
" "+
""+
"" ;
return res ;
} // End of buildMessage
void callWs(String msg , int i)
{
def request2 = testRunner.testCase.getTestStepByName("ping") ;
def prop2 = request2.getProperty("request") ;
log.info(msg+i) ;
String Rqt = buildMessage(i) ;
prop2.setValue(Rqt) ;
// Call
testRunner.runTestStepByName("ping") ;
}
String readResponse()
{ // Read the anwser
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context ) ;
def holder = groovyUtils.getXmlHolder("ping#Response") ;
String x = holder.getNodeValue("//ns1:pingResponse[1]/pingReturn[1]") ;
return x ;
}
callWs("Appel n° 1/1 ",1) ; log.info("Retour de 1 "+readResponse()) ;
callWs("Appel n° 2/4 ",4) ; log.info("Retour de 2 "+readResponse()) ;
callWs("Appel n° 3/400 ",400) ; log.info("Retour de 3 "+readResponse()) ;
callWs("Appel n° 4/8 ",8) ; log.info("Retour de 4 "+readResponse()) ;
testRunner.gotoStepByName("End") ;
3) The groovy assertion of the ping request def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context ) ;
def holder = groovyUtils.getXmlHolder(messageExchange.responseContent) ;
x = holder.getNodeValue("//ns1:pingResponse[1]/pingReturn[1]") ;
i = Integer.parseInt(x,10) ;
//log.info("Assert 2 i "+(2*i)) ;
int min = -1000 ;
if ((min < i) && (i < 0))
{ assert true ; }
else
{ assert false ; }
4) Soapui trace and serveur trace when min = - 1000soapui trace :
Tue Jan 19 10:24:38 CET 2010:INFO:Appel n° 1/1 1
Tue Jan 19 10:24:39 CET 2010:INFO:Retour de 1 -1
Tue Jan 19 10:24:39 CET 2010:INFO:Appel n° 2/4 4
Tue Jan 19 10:24:39 CET 2010:INFO:Retour de 2 -4
Tue Jan 19 10:24:39 CET 2010:INFO:Appel n° 3/400 400
Tue Jan 19 10:24:39 CET 2010:INFO:Retour de 3 -400
Tue Jan 19 10:24:39 CET 2010:INFO:Appel n° 4/8 8
Tue Jan 19 10:24:40 CET 2010:INFO:Retour de 4 -8
Tue Jan 19 10:24:40 CET 2010:INFO:Step End. Au revoir
Axis server trace :
- Appel de ping avec 1
- Appel de ping avec 4
- Appel de ping avec 400
- Appel de ping avec 8
Every things are OK : 4 calls => 4 requests => 4 responses.
5) Soapui trace and serveur trace when min = - 10soapui trace :
Tue Jan 19 10:28:35 CET 2010:INFO:Appel n° 1/1 1
Tue Jan 19 10:28:36 CET 2010:INFO:Retour de 1 -1
Tue Jan 19 10:28:36 CET 2010:INFO:Appel n° 2/4 4
Tue Jan 19 10:28:36 CET 2010:INFO:Retour de 2 -4
Tue Jan 19 10:28:36 CET 2010:INFO:Appel n° 3/400 400
Tue Jan 19 10:28:37 CET 2010:INFO:Retour de 3 -400
=> Assertion FALSETue Jan 19 10:28:37 CET 2010:INFO:Appel n° 4/8 8
Tue Jan 19 10:28:37 CET 2010:INFO:Retour de 4 -400
=> Expected -8Axis server trace :
- Appel de ping avec 1
- Appel de ping avec 4
- Appel de ping avec 400
This is not what I want : 4 calls => 3 requests => 3 responses.
soapui bug or not? 6) How to solve?It seems that a false assertion "locks" the ping wsdl test step. So each call to this step, after a false assertion, does not send the request and does not compute again the assertion (according the new received data). Nevertheless, when I laung again the test, the ping setp is "reset", so the first and the second call are OK.
[s:394fiiaz]Disable and enable the ping step[/s:394fiiaz] : Does not work.
How to "reset" the ping step ?
Must I delete and create the ping step at each call? How to do that? How to add the : SOAP response, No SOAP Fault, Schema Compliance, Groovy script ?