SoapUI Beginner Tutorial: What is SoapUI and Features

SoapUI Tutorial for Beginners. This tutorial is for the soap UI free version. The contents of this tutorial are what is SoapUI, how to install SoapUI on your computer, the SoapUI Integrated Development Environment, how to work with projects in SoapUI, the different request types in SoapUI and how to run SoapUI tests.

What is soap UI?

SoapUI is a free and open-source tool to test web services. It can test both types of web services that is soap web services and restful web services. You can use SoapUI for both functional testing and performance testing of web services. Since SoapUI is written in Java programming language, SoapUI is cross-platform, which means that it can run on multiple operating systems like Windows, Mac OS and Linux. Now, let us learn soapui automation.

How to install SoapUI?

The steps to install SoapUI free version are simple. In order to install soap UI tool, just download the SoapUI installer from the official website, which is soapui.org Then double click to run the Installer. You have to select some settings like the destination folder (you can change it if you want), the components, tutorials location, Start menu folder and desktop icon and click on the Finish button. Now, let us see the actual installation of SoapUI. This is the SoapUI official website and once you go there, you have to click on the Get It button and save the file. In order to save time, I have already downloaded the SoapUI installer. Now, double-click on it or you can right-click on it and click on Open. Run it. This opens the SoapUI installer. So, just click on the Next button and accept the agreement. You can change the location of the destination folder if you want. Use the defaults. Again, accept the agreement. You can change the location of the tutorials folder. Click Next, create a Start Menu folder and create a desktop icon. Click Next. And then just click on the Finish button. Now SoapUI is installed. We’ll just open it shortly. But first, let us go to soap ui basics. Now, SoapUI Integrated Development Environment has three main windows. The first window is the Navigator. So, it is the top left-hand side window. It shows the project tree-view which has the project, interfaces, methods and requests.

In order to delete an item, you can just select it and press the Delete key. Or you can right-click on the item and select the Remove menu option. The second window is the Desktop or Inspector. It is the right-hand side window. You can double-click any item in the Navigator and the Inspector window shows the item’s details. The third window is the Properties window. It is the bottom left-hand side window. The Properties window shows the properties of the item selected in the Navigator window above. You can use properties to specify your test case. For example, you can change the service endpoint or you can enter the user name and password for a request.

Now, let us learn about the test structure in SoapUI. There are three levels in the test structure. These are Test Suites, Test Cases and Test steps. A test suite is a set of test cases. You can group test cases according to your needs into one or more test suites in a single project in soap UI. A test case is a set of test steps. The test steps together test a particular functionality of the web service. A single test step either does some action or validate some data. When you run a test case, the test steps are executed in the order in which they are given. Now, let us start soapui testing. So first, we open SoapUI. Go to All Programs, SmartBear and SoapUI. SoapUI saves a project as a single file in XML format. We can see an example. This is the file in XML format. In SoapUI, in order to create a new project, click File and New soap project. You can give the project name. Then give the WSDL and click on the OK button. If you have an existing SoapUI project, you can click on the Import button or click on File>Import Project. Let me import an existing project. Now in the navigator, you can double-click any request to create a sample request in the Request window. So let us expand this. For example, here is a soap request and I double-click on it. It will open it in the Inspector window on the right. This sample request has a question mark in place of parameters. You can run the request. For example, you can give some data here. This request converts a number to words. So for example, I type in 123. And you can click on the green arrow icon to run this request. And here, you can see this number has come in words one hundred and twenty-three Now in order to create a test suite, you can right-click on the interface and click Generate test suite menu option to create a test suite. Or you can go to Project and click on New test suite. I already have a test suite here. It is a basic test suite.

In order to run a test suite, double-click the test suite and click the green arrow icon in the test suite window. So, I’m going to click it now and the test suite is running. You can click the red square icon to cancel the running test cases. For example, let me run this test suite again and when I click on the red icon, it cancels the test suite. Now let us learn about the test case. What is a test case a part of? It belongs to a test suite. In order to create a test case, what you can do is you can right-click on the test suite and click on New test case menu option. Another way to add a test case is that in the Request window, you can click Adds this request to a test case button. Now, let us learn about the test step. So let us expand this test case. It has two test steps in it. So where does a test step belong? It is a part of the test case. So in order to add a test step and you can right-click on it and click on the Add Step menu option. So the available test steps are Soap Request. This test step sends a soap request and gets the soap response back. It is linked to the project WSDL, that we gave at the time of creating the new project. This test step is used to test soap web service. The second is the REST Request test step. This test step sends a REST request and gets the response. It is linked to any REST-based web services configured in the project. The third test step is the HTTP Request. This test step sends an HTTP request and receives the results in XML data format. Another possible test step that you can add to the test case is AMF Request. AMF stands for Adobe’s ActionScript Messaging Format. AMF format is used by Flash or Flex applications. This test step sends an AMF request and gets the result in XML format. JDBC Request. This test step sends a database query to a database and gets the result in XML format. Properties test step. You can add a Properties test step, in which you can add custom properties. Or you can add a Properties Transfer test step. There is a Conditional GoTo test step. this test step takes for a specific value in the last response. Then based on a condition, it goes to another respective test step. Run TestCase. This particular test step simply transfers control to another test case. Groovy Script. This test step contains a script to do complex actions like reading and writing data or looping or complicated validations or sending emails, etc. There is a Delay test step available. This test step halts the execution of the test case for the specified milliseconds. SOAP Mock Response. This test step gets an HTTP request and receives a pre-defined response. It is useful for the test of soap-based web services. Or you can add a Manual TestStep also. Another way to add a test step is in the Test Case window, you can click any icon.

For example, Create a new SOAP request TestStep, new REST request TestStep and so on. The good thing is that test steps can be individually disabled or enabled. So you can right-click on the test step and you can disable it or enable it. Or you can rename it or you can delete it or you can move the test step up and down. So all these features help in test debugging.

Next, let us learn about validations. Do you remember what are validations called in SoapUI? They are called assertions. An assertion is an expected result. So one of the available assertions is Properties Content. You can click on the + icon to add an assertion. So in Properties Content, you can select Contains and click on the Add button and you can give it a name and you can write any content that you want. I already have assertions added here. So let me open this Contains. Now here, I can add any text that I want in the response. So this is one assertion. Now, if we run this particular test step, the assertions are also going to be tested. So we can see all the assertions passed here. Now, instead of the dollar, if we give euro and click on OK, then it shows a red icon meaning that this assertion failed. So let us change it back to dollar or dollars because that is what we are expecting in the response. Now there are other assertions like SLA assertion. In it, you can specify the maximum acceptable response time. Or there can be other assertions like schema compliance, etc. Next, let us see how to run tests in SoapUI. So in order to run tests, what you can do is, first of all, you can click on the service definition. Open the service definition. And here go to the Service Endpoints tab. And you can update the URL if you want. Then all you need to do is open up your test suite and simply click on the green arrow icon. This will run all the test cases and within each test case, each of the test steps is going to run. Now we can also run SoapUI from the command line, so let me open the command line. So there is a file called test runner dot bat so let us go there. So here is testrunner dot bat. Let us go there and you can give the testrunner command. It will show you all the available options.