Introduction to Interface Testing:
When an application or a software or a website is developed, then there are several components of it. Those components can be server, database etc.
The connection which integrates and facilitates the communication between these components is termed as an Interface.
In simple terms, an interface is a software comprising of a set of commands, messages etc.
This tutorial gives you a complete overview of Interface testing along with its need, type, strategy, checklist and some of its tools in simple terms to enrich your knowledge of the concept.
What You Will Learn:
- When and Why Should we Test an Interface?
- Types of Interface Testing
- Strategy or Approach for Interface testing
- Difference between Interface, Integration and Component Testing
- Checklist for Interface Testing
- Best Tools for Interface Testing
- Recommended Reading
For a computer, an interface can be APIs, web services etc. The communication between the different components of a software or an application or a website can affect the overall performance hence this communication i.e. the interface also needs to be tested and verified.
The testing that is done to verify the interface functionality is called Interface testing.
The 2 common components of Interface testing include:
- Web server and application server interface.
- Database server and application server interface.
When and Why Should we Test an Interface?
Mentioned below are the 3 phases of Interface testing in an Interface lifecycle:
1) Configuration and development:
When the interface is configured, and once the development starts, the configurations need to be verified as per the requirement.
When the development is completed, the interface needs to be validated and verified, this can be done as a part of unit testing also.
Once the whole software is ready, deployed and working, then the interface needs to be monitored for its performance and any new issues introduced due to the changes made or deteriorating performance.
When we start developing an interface, we need to make sure that we are not introducing any defects in our code and hence tests need to be run on the interface to verify that adding new code is not injecting any new defects. This will help you to determine whether the interface is defect free and as per the requirement.
Once we are satisfied with the interface, we validate it for the intended workflow, data etc. We can run performance, huge data tests and check how well the interface responds. This will save a lot of time that will be spent on fixing the defects later.
In a nutshell, Interface testing is done to:
- To check if the server execution is proper.
- Error handling is done properly, and appropriate error messages are shown for queries made by the application or software.
- To check the result when a connection to the server is reset.
- To check the security aspect when the components communicate within themselves.
- To check the impact of network failure on the communication between the components.
Types of Interface Testing
Interface testing is basically done on the messaging layer of the system architecture. It mostly involves testing the REST API or SOAP web service with JSON or XML format.
Interface testing typically involves the following practices:
- Unit Testing: Testing the functionality of each individual operation (in a function).
- Functional Testing: Testing the functionality of broader scenarios involving test case creation, validation, regression etc.
- Load testing: Validating the performance under load, mostly by using functional test cases.
- Security testing: Testing the security mechanism and it includes penetration testing as well as validating access control, encryption etc.
- Runtime error detection: Monitoring an application for problems like runtime race, resource leak, etc.
- Workflow testing: This is done to ensure if the interface engine handles your workflow as expected.
- Individual Systems: This testing is done to verify the individuality of each system. Like the billing system and inventory management system should be able to operate individually.
Strategy or Approach for Interface testing
Just like any other testing, Interface testing is equally important as it ensures seamless functioning, performance etc. of various data-driven applications and systems, by verifying the communication between the database, networks, and systems.
Interface testing becomes more important when we verify the application’s dependencies with other apps.
Given below are few steps that ensure Interface testing to be successful:
1) Define your Requirement:
Before creating the Interface tests, it is essential to understand the application. Hence try to find answers to questions like what is the purpose of the interface? What is the workflow of the system or application? What are the functions and features of the interface?
Defining all such answers will help you to understand the requirement, find out tricky points of the application and then create the test cases accordingly. Often, QA's miss this, and later on this leads to confusion about the requirement or incorrect testing.
2) Expected Output:
Now, we know and understand the requirement very well, it is the time to finalize the output that we will be expecting from the tests. Not just a Pass or Fail, it can be some data, call to another API etc. It can, not only be tricky but also risky to measure the outcome of the expected result.
Hence try to find out what could be the outcome by discussing with the developers.
3) Start Small:
With interface testing, we can’t directly move on with creating big test cases, creating small test cases or calls is relatively simple. At least, in small functions, create small test code and verify if the output is as expected or not.
4) Try Automating:
Writing codes for testing an interface can be boring.
You will not only be spending time in writing the code but along with this you will also have to spend time to understand the format, style, the coding language used for development and then as an icing on the cake you will have to make sure that your code isn’t creating a problem to the app or system code.
Hence it is better to research and find some automation tools which will save your day. It will be much easier and a time-saving process too.
5) Define the Start and Stop points:
Before starting the execution of a test, we always decide the start (entry) and the stop (exit) point of the test, as well as decide how the entire testing process will start and end. Similarly, we need to measure the performance level of the Interface testing as well.
To do that, we need to find the answers to the following two questions:
- What is the expected completion time for an interface test?
- What is the actual completion time of an interface test?
This step of involving the entry and exit points of an interface test will help you to find the performance level of the tests. This will also help you to take a decision about the planned test schedule.
Difference between Interface, Integration and Component Testing
Given below are few differences:
|S.No.||Component Testing||Interface Testing||Integration Testing|
|1||Testing a component individually to verify the expected result is called component testing||Testing an interface to verify the expected result is called interface testing.||When all or a few modules or components are integrated to function collectively; then testing done to verify the end to end functionality of the integrated components is called integration testing.|
|2||A component can be anything like a screen, login module etc.||Interfaces are widely web services, API, connection strings etc.||Integration can be one complete use case like for a banking app, log-in and add your ‘Beneficiary’ etc.|
|3||This testing is relatively easy.||This testing is tricky and tedious.||This testing is little easy but length.|
|4||Manual and automation both are applicable.||Mostly automation.||Manual and automation both are applicable.|
|5||This testing is applicable to both code and GUI of the app or system.||This testing is done only on the code; there’s no GUI.||This testing is applicable to both code and GUI of the app or system. But it’s mostly GUI.|
Checklist for Interface Testing
Given below are some checklist pointers that are to be considered for Interface testing:
- 4xx and 5xx errors should be included in the tests because they will help you to verify the server side and client-side error handling, ideally, an appropriate message should be shown rather than a code error.
- Validation of the user using the HTTP authentication.
- Verify all the methods that are used in the API or web services like GET, PUT, POST etc.
- Verify the conversion from JSON format to XML format and vice versa.
- Verify whether the bulk operations on an interface are fetching the expected result.
- Verify if the time zone of the API is matching the specification of the time zone of a geographical area.
- Verify if unauthorized access to the interface leads to a proper error message.
- Verify if the connection interruptions are handled properly.
- Verify if some components are removed from the application then the interface is not interacting with those components anymore etc.
Best Tools for Interface Testing
As companies are moving towards DevOps, Continuous Integration (CI) and Continuous Deployment (CD), testing feedback needs to be quicker than ever. Before you get ready to ship your application, you need to make sure that the interfaces are well tested. Manually testing the interface can be very tedious, complicated and a time-consuming process too.
The best method to perform interface testing is to use automation and include the interface testing in your automation plan.
Hence following is a list of the tools that will help you to complete your interface testing as quickly as possible. However, I would personally recommend using SoapUI (I used this tool in my project for Web services testing) but every requirement is different hence let us take a look at the 5 best tools.
The top 5 tools include:
For people working with Java, REST – Assured is the most preferred tool. In fact, it is the best tool for API testing with Java because verifying REST web services in Java is quite difficult. It is designed for testing purposes, hence it can easily integrate with any Java-based framework.
It has a lot of cooked in functionalities, hence you won’t need to code things from the beginning. This tool integrates well with the Serenity framework and you can generate awesome test reports.
Some testers don’t like to use the same coding language as of the IDE. For such people, Postman is a good option for automation. This is also a good option for an exploratory interface testing.
Postman is a simple REST-client and one can quickly start leveraging its Chrome plugin. It has a native version available, which can be used for Mac, Linux, and Windows. It has a UI which helps in building requests and checking the received response.
If your team is doing only API testing, SoapUI can be a great choice. It is a complete functional testing tool devoted to API testing. It also supports Data-driven testing where the data can be passed in CSV or excel format. It also has a paid version called SoapUI Pro which offers even better and improved features for web service testing.
If you want to add extra code for some specific workflow or functionality, use Groovy for your scripting. You can also create a global variable setting and use all those variables in your tests rather than initializing individually for each test.
JMeter is widely used for load testing and it can be used for interface testing too. JMeter has a record & playback support and it generates HTML reports which are easy to read and understand. As JMeter is compatible with CSV files, this allows you to create unique parameters for testing.
It is easily integrable with Jenkins so that your tests can be included in the CI. If you want to use the same tool for an interface and load testing, then JMeter will be a worthy choice.
Fiddler helps you to check and use (again) the HTTP requests. It has many features that help you to debug the website issues, with its extensions, and you can do much more. It is also a good tool for security testing as it can be configured to decrypt the encrypted request and then modify the requests for testing purposes.
One of Fiddler’s extensions is APITest extension, this helps to verify the web behavior of an interface. For more intense interface testing you can try using the FiddlerCore.Net library to create your interface testing infrastructure.
Interface testing is a very important part of testing for large-scale applications and it is a must to do it. Even in the applications where CI is regularly followed it becomes important to perform Interface testing.
Interface testing is quite tricky and not straight-forward, hence a proper strategy should be designed to perform this testing. Also, remember to take the inputs from the development team as they understand the code better.
The best and simplest way to perform this testing is to automate and integrate the testing suite in the CI so that a lot of time will be saved, and the results will be achieved at a faster pace.
Have you performed Interface Testing? Feel free to share your experiences and let us know which tool and strategy were implemented by you.