Script Filtering in Transaction Log

Applies to ReadyAPI 3.51, last modified on March 21, 2024

Use the condition script to filter the requests in the Performance Tests Transaction Log. If the script returns true, the request results are displayed. Otherwise, the results are discarded.

Available Properties

The condition script has access to the soapui_context object. You can use code completion to get access to its methods and properties.

Here are some useful properties that you can use in your scripts:

Property Description
empty Boolean. true if soapui_context does not contain any information, false otherwise.
request String. Raw request text. Same as Request column.
response String. Raw response text. Same as Response column.
responseSize Number. The size of the received response in bytes. Same as Bytes column.
runningVUCount Number. The full number of virtual users that were working when the selected virtual user stopped working. Same as Currently Running column.
status Boolean. true if the target test case was run successfully and false otherwise. Same as Status column.
statusCode Number. The response HTTP status code. Same as HTTP Status column.
timeTaken Number. How long the test execution took in milliseconds. Same as Time Taken (ms) column.
waitTime The number of milliseconds ReadyAPI Performance waited for the server to accept the request. Same as Wait Time (ms) column.

Returning the Value

In Groovy scripts, you use the return keyword to return data. If the script does not contain the return keyword, ReadyAPI will use the value of the last line.

Return true to display the request results and false to discard the results.

If the value is not boolean or the line does not return anything, nothing will be displayed in the log.

You can test the request against multiple conditions by making them a single expression connected with logical operators:

soapui_context.statusCode == 500 |<td></td>| soapui_context.statusCode == 200

Here is how you use the return expression to return the value you need explicitly:

if (soapui_context.statusCode == 500 || soapui_context.statusCode == 200)
{
    return true
}
else 
{
    return false
}

Sample Scripts

Here are some script samples that show how you can:

  • Check if the response contains specific text:

    soapui_context.response.contains('My response text')
  • Get all executions with 500 or 200 response code:

    soapui_context.statusCode == 500 || soapui_context.statusCode == 200
  • Get all executions for which it took over 10 ms and under 25 ms to be completed:

    soapui_context.timeTaken > 15 && soapui_context.timeTaken < 25

See Also

About Transaction Log
Configuring Request Logging

Highlight search results