The Script assertion runs a groovy script to perform custom checks on the message. Use it to verify the message content, headers, properties and other components.
This assertion is available in multiple ReadyAPI applications. Depending on the application, it validates the following data:
|In...||Checks...||To learn more...|
|SoapUI functional tests||The request or response.||See Working With Assertions in SoapUI.|
|SoapUI security tests||The response.||See Security Assertions.|
|ServiceV||The request.||See Assertions in ServiceV.|
Write a script verifying the value you need. Some script examples are available below.
|Tip:||If the font of the editor is not comfortable for you, change it by using Ctrl + mouse wheel.|
Assertion scripts have access to the following objects:
For information on methods, see the Apache
For information on methods, see the Context object documentation.
For information on object methods, see the MessageExchange object documentation.
Click to test your script.
|Make sure you have the value to assert before testing the script.|
The following script validates the response’s HTTP header:
The following script verifies that the response was received within the specified time limit:
The following script verifies that the attachment exists:
The following script verifies that the
RequestId XML element exists: