
- SoapUI Tutorial
- SoapUI - Home
- Soap Basics
- SOAP - Introduction
- SOAP - Messages
- SOAP - What is REST?
- SoapUI Basics
- SoapUI - Introduction
- SoapUI - Capabilities
- SoapUI - NG Pro
- SoapUI - Installation & Configuration
- SoapUI - WSDL
- SoapUI - Project
- SoapUI - TestSuite
- SoapUI - TestCase
- SoapUI - TestStep
- SoapUI - Request & Response
- SoapUI - Properties
- SoapUI - Property Transfer
- SoapUI - Logs Pane
- SoapUI - Assertions
- SoapUI - Troubleshooting
- SoapUI - Performance Testing
- SoapUI - Load Testing
- SoapUI - RESTful Web Services
- SoapUI - JDBC Connection
- SoapUI - JDBC Property
- SoapUI - JDBC Assertion
- SoapUI Useful Resources
- SoapUI - Quick Guide
- SoapUI - Useful Resources
- SoapUI - Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
SoapUI Assertion - Script
Script Assertion technique is the most widely used technique since managing and maintaining hundreds of assertions are quite difficult for a long response message.
SoapUI uses either Groovy Scripting or JavaScript for scripting assertions. The scripting technique is adopted for developing a framework for testing SOAP.
Important Features
Scripting allows the user to perform different operations before and after executing a TestCase using setup and tear down methods respectively.
Setup is a procedure which is executed before executing a particular method (Example – Object creation and Initialization).
Tear down is a procedure which is executed after executing the method (Example - Destroying objects and clean up).
This feature is not available in other Assertion types and can be done only through scripting language.
It allows the users to perform opening/closing a Project, in order to initialize or clean up project-related settings and also to work with environmental variables, which is very helpful during scripting.
It helps in asserting a dynamic Response content.
Scripting assertions are used for creating user-defined assertions that are NOT predefined by SoapUI.
Adding Script Assertion
We will follow the same TestCase “ConversionRate TestCase” of CurrencyConvertor.
Step 1 − After clicking Add Assertion, select Assertion Category – Script.
Step 2 − Select Assertion Type – Script Assertion.
Step 3 − Click Add.

The Script Assertion wizard opens, where the script should be defined to validate the response message.
Step 4 − Write a Groovy script to validate the Conversion Rate. It is recommended to have knowledge on JavaScript or Groovy Script before attempting to write the script.

Step 5 − Click 'Execute' button to trigger the execution.
The output of the Script is shown in the Output pane. It has printed both, Conversion Value as well as the end result (Pass or Fail).

The information displayed is 'Script Assertion Passed'. Click OK.

Note − The final Information popup will always display the message 'Script Assertion Passed' as long as the script is syntactically correct. It has no correlation with the assertion within the script.