Use the condition script to filter the requests in the LoadUI Transaction Log. If the script returns
true, the request results are displayed. Otherwise, the results are discarded.
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:
||String. Raw request text. Same as Request column.|
||String. Raw response text. Same as Response column.|
||Number. The size of the received response in bytes. Same as Bytes column.|
||Number. The full number of virtual users that were working when the selected virtual user stopped working. Same as Currently Running column.|
||Number. The response HTTP status code. Same as HTTP Status column.|
||Number. How long the test execution took in milliseconds. Same as Time Taken (ms) column.|
||The number of milliseconds LoadUI waited for the server to accept the request. Same as Wait Time (ms) column.|
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.
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:
Here is how you use the
return expression to return the value you need explicitly:
if (soapui_context.statusCode == 500 || soapui_context.statusCode == 200)
Here are some script samples that show how you can:
Check if the response contains specific text:
Get all executions with
200 response code:
Get all executions for which it took over 10 ms and under 25 ms to be completed: