Forum Discussion

Raghav19's avatar
Occasional Contributor
6 years ago

API script assertion not running when running from testcase although run from step is success

I have a testcase with one API for which Script assertion is used to ready the ReadyAPI log.

This script runs and passes the step when run from the step directly.

But when i run from the testcase level, it fails, not sure why this occurs.

My requirement is to run the script irrespective of pass or fail of the request because my script is reading the log to understand that.

The API request and script are as follows:

def logArea = com.eviware.soapui.SoapUI.logMonitor.getLogArea("ReadyAPI Log");
def model = logArea.model
if (model.size > 0) {
   val = false
   for (c in 0..(model.size - 1)) {
       if (String.valueOf(model.getElementAt(c)).contains("Connection refused: connect")){
       	val = true
     if(val != true) {
     	throw new Exception("Assertion failed")
  else {
  	throw new Exception("Assertion failed here")


1 Reply

  • luluberlu's avatar
    Occasional Contributor



    In soapui 5.4.0 version, i don't have "ReadyAPI Log". 

    I put your script with "script log" and it runs well, in all cases.

    val = true case , val = false or model.size = 0

    Tue Dec 11 13:09:06 CET 2018:INFO:Tue Dec 11 13:09:06 CET 2018:INFO:Connection refused: connect


    So witch version do you use ? take care on upper and lower case in "ReadyAPI Log" value..