soapui - How to get assertion value using groovy script -


i have 1 test step contains 2 assertion.

  • not soap fault
  • contains. condition response should contain "message sent successfully"

now have 1 groovy script, executing test step. using groovy script need print assertion name, value , status. below code have written:

teststepsrc = testcase.getteststepbyname(testname) assertioncounter = teststepsrc.getassertionlist().size() (assertioncount in 0..assertioncounter-1) { log.info("assertion :" + teststepsrc.getassertionat(assertioncount).getname() + " :: " + teststepsrc.getassertionat(assertioncount).getstatus())  error = teststepsrc.getassertionat(assertioncount).geterrors() if (error != null)    {     log.error(error[0].getmessage())    }  } 

but in output displaying like:

wed sep 04 17:21:11 ist 2013:info:assertion :not soap fault :: valid wed sep 04 17:21:11 ist 2013:info:assertion :contains :: valid 

as can see, able print assertion name , status not value of 'contains' assertion. please me how value of particular assertion.

thanks in advance.

so here things read

and tried

def assertionslist = testrunner.gettestcase().getteststepbyname("test step name").getassertionlist() for( e in assertionslist){     log.info e.gettoken() //gives value of content search     log.info e.description     log.info e.id     log.info e.label     log.info e.tostring() } 

this gives following output

wed sep 04 15:12:19 adt 2013:info:abhishek //the contains assertion checking word "abhishek" in response of test step assertion applied. wed sep 04 15:12:19 adt 2013:info:searches existence of string token in property value, supports regular expressions. applicable property.  wed sep 04 15:12:19 adt 2013:info:simple contains wed sep 04 15:12:19 adt 2013:info:contains wed sep 04 15:12:19 adt 2013:info:com.eviware.soapui.impl.wsdl.teststeps.assertions.basic.simplecontainsassertion@c4115f0 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -