Test approaches in SOA testing
Approaches to test SOA architecture are usually based on the scope of the project and requirements to test. Let's look at an example.
Following is a diagram of a three-tier architecture based on SOA architecture:
- Validation1 or V1: Validation of integration between Presentation Layer to the Services Layer
- Validation2 or V2: Validation of integration between Services Layer to the Service Catalogue Layer
- Validation3 or V3: Validation of integration between Product catalogue layer and the database or backend Layer
So we have three integration points which makes us understand that we need integration testing also with functional, performance and security testing. So let's sum up the types of testing that are required to test end-to-end Greenfield projects.
- Functional testing
- Integration testing
- Performance testing
- Security testing
- Automation testing
Functional testing
A web service may expose single or multiple functionalities via operations and sometimes we need to test a business flow which requires calling multiple services in sequence which is known as orchestration testing in which we validate that a particular business flow meets the requirement.
Let's see how to configure a SOAP service in SoapUI for functional testing
- Open SoapUI by clicking on the launch icon.
- Click on File in upper-left corner of the top navigation bar.
- Click on New SOAP Project heading in the File menu.
- Verify that a popup opens up which asks for the WSDL or WADL details. There are two ways you can pass a URL to the web location of the WSDL, or you can pass a link to the downloaded WSDL on your local system.
- Enter the project name details and the WSDL location which can either be on your local machine or be called from a URL, then click on OK. You may verify that the WSDL is successfully loaded in SoapUI with all the operations.
- Now you can see that service is successfully loaded in the workspace of SoapUI.
- Now, the first step toward an organized test suite is to create a test suite and relevant test cases. To achieve this, click on the operation request:
- When you click on Add to TestCase you are asked for the test suite name and then a test case name and finally you will be presented with the following popup:
Here you can create a TestCase and add validations to it at run time.
- After clicking OK you are ready to start your functional and integration testing:
Let's take an example of how to test a simple web service functionally.
Test case: Validate that Search Customer searches for the customer from the system database using an MSISDN (Telecom Service).
Note
Please note MSISDN is a unique identifier for a user to be searched in the database and is a mandatory parameter.
API to be tested, Search Customer:
- Request body:
<v11:SearchCustomerRequest> <v11:username>TEST_Agent1</v11:username> <v11:orgID>COM01</v11:orgID> <v11:MSISDN>447830735969</v11:MSISDN>
So to test it we pass the mandatory parameters and verify the response which should get us the response parameters expected to be fetched.
By this we validate that searching for the customer using some Search criteria is successful or not, similarly, in order to test this service from a business point of view we need to validate this service with multiple scenarios. Following is a list of a few of them.
Considering it's a telecom application search customer service:
- Verify that a prepay customer is successfully searched for using Search customer
- Verify that a post-pay customer is successfully searched for using Search customer
- Verify that agents are successfully searched for using search customer
- Verify that the results retrieved in response have the right data
- Verify that all the mandatory parameters are presenting the response of the service
Here is how the response looks:
Response Search Customer
<TBD>
Previous are some examples of Priority1 scenarios that you will require to test this service we will give it a deeper look in the following chapters.
Performance testing
So is it really possible to perform performance testing in SoapUI?
The answer is yes, if you just want to do a very simple test on your service itself, not on the orchestration.
SoapUI does have limitations when it comes to performance testing but it does provide you a functionality to generate load on your web service with different strategies.
So to start with, once you have created your SoapUI project for a service operation, you can just convert the same to a simple load test. Here is how:
- Right-click on the Load Test option available:
- Now select the name of the load test; a more relevant one will help you in future runs.
- You will now see that the load test popup appears and the load test is created:
- There are several strategies to generate load in SoapUI. The strategies are as follows:
- Simple
- Burst
- Thread
- Variance
We will learn more about performance testing using SoapUI in the following chapters.
Security testing
API and web services are highly vulnerable to security attacks and we need to be absolutely sure about the security of the exposed web service depending on the architecture of the web service and the nature of its use.
Some of the common attacks types include the following:
- Boundary attack
- Cross-site scripting
- XPath injection
- SQL injection
- Malformed XML
- XML bomb
- Malicious attachment
SoapUI's security testing functionality provides scans for every attack type and also, if you want to try a custom attack on the service by writing a custom script.
So the scans provided by SoapUI are as follows:
- Boundary scan
- Cross-site scripting scan
- XPath injection scan
- SQL injection scan
- Malformed XML scan
- XML bomb scan
- Malicious attachment scan
- Fuzzing scan
- Custom script
Following are the steps for how we configure a security test in SoapUI:
- You can see an option for Security Tests just below
Load Tests
in SoapUI. - To add a test, right-click on the Security Tests and select New SecurityTest:
- Now select New SecurityTest and verify that a popup asking the name of the security test opens:
- Select the name of the security test and click on OK.
- After that, you should see the security test configuration window opened on the screen. For the service operation of your test case, in case of multiple operation in the same test case, you can configure for multiple operations in a single security test as well.
For this pane you can select and configure scans on your service operations.
- To add a scan, click on the selected icon in the following screenshot:
- After selecting the icon, you can now select the scan you want to generate on your operation:
- After that you can configure your scan for the relevant parameter by configuring the XPath of the parameter in the request.
- After that you can select Assertions and Strategy tabs from the below options:
- You are now ready to run you security test with Boundary Scan:
Now we have learnt how to configure a simple security test in SoapUI, we will learn more about it in detail in the coming chapters.