Automation with SoapUI — Part I

9series Solutions
5 min readOct 2, 2018

--

The appearance of APIs (Application Programming Interface) and communication protocols like SOAP and REST took software development into an altogether different level. It became relatively easy to integrate completely different services and develop more powerful and useful softwares. APIs became an important part of software development and also one on which the entire software are sometime depended on. This led to the developers and more specifically, testers, to focus on making APIs more reliable and bug free as much as possible. API Testing today, is an integral part of the testing process. The APIs must be tested thoroughly by integrating them with others APIs to check the combine response of entire user cases, before they are implemented in the software to avoid bug multiplication. This is where API Test Automation comes into the picture.

API test automation helps reveal integration issues across the entire chain of services or systems, thus preventing number of bugs and issues, not to mention the time and efforts required to fix the issues after bug leakage. Even a small change in an API will give a different response, and will be detected by automating API testing.

SoapUI is one of the leading open source cross-platform API Testing tool. Testers can execute various automated functional, regression, compliance, and load tests on SoapUI. SoapUI interface is one of the simplest, enabling both developers and testers users to test seamlessly. Let us discuss some of the most helpful features of SoapUI.

Drag and Drop Test Creation
SoapUI provides a great user interface for test creation using the drag and drop feature. For creating test cases, there is no need to code or script, one can simple drag the and drop the API requests in the project to test case without any hassle. So, it is equally easy for developers as well as QA engineers to create complex test cases and test suites.

This features increases productivity and saves times & efforts needed to write test cases using coding or scripting.

Assertions
While automating API test cases, you need to verify if the response received is as expected. While it may be difficult and exhausting to verify the responses of each and every API in each and every test cases & suites manually, but it is necessary. To avoid this exhaustive process, SoapUI has Assertions. You add assertions to test cases to validate their responses while they are executed.

If the response does not matches the expected response mentioned in the assertion, the test case is failed and execution stops. This helps in validation of API responses in functional automation testing. You can add assertions for response codes, script assertion, property value assertion and many more.

Correlation
For creating complex business logic scenarios and workflows, data from responses of APIs needs to be used as request body for other API. To correlate these data, SoapUI provides a Property Transfer step to save these values in properties (similar to variables) at various levels like Test Suite level, Test cases level, etc. These properties can be referred anywhere within an API request depending upon its scope of declaration level. A property at Test Suite level can be used in any test cases within the same test suites. Similarly, a property at Test Cases level can be used in the requests within the Test case.

Correlation can be used for passing values generated during run-time or execution of automated test cases.

Environment
Developers and Testers need different environment to test API. Sometimes, both developers & testers need to run tests in different environment like staging, deployment, UAT (User Acceptance Testing) or production. SoapUI allows users to save multiple environments beforehand. User can adds different properties, database connections and services in different environment. User can change to different environment by just clicking on environment dropdown list and selecting the user defined environments. This allows user to save time by preventing tedious amount of efforts to change environments.

Scripting
Although, SoapUI does not need scripting to write test cases and create test suites, it can be used extensively for creating powerful and complex assertions and to manipulate the behaviour of the test cases according to needed specification. Using Groovy language, you can write scripts for test cases. Scripts can be written using various ways –

1. Script TestSteps — These steps will be executed when the test case in which it is included is run.
2. Setup and TearDown Scripts — These script steps are executed before and after a test case is run respectively. Setup script is executed before the test case, while TearDown script are executed after the test case is executed.
3. Script Assertion — User can create assertion for test case using Groovy scripts. This allows users to write more complex assertion making it more reliable.

Scripting also allows users to expand the scope of the properties dynamically, so that test cases out the current scope can access the properties within the scope.Many more scripting options are available in SoapUI Pro version.

Closing Note
Automated API testing is important process of Quality Assurance of any mature software development company. SoapUI is a very powerful and valuable tool in the hands of developers and tester for functional, load, regression and integration testing. It allows QA engineers to work on the workflow and business logic level to test the functionality of the system under development. As the result, the stability of the system is regularly maintained to ensure its continuous operation during production and afterwards. There is a second blog in this series. Stay Tuned to read the next blog on SoapUI.

Source : https://www.9spl.com/blog/automation-soapui-part/

--

--

9series Solutions

9series is an eminent enterprise mobility & website development organisation with niche in delivering quality services & solutions to customers across the world