End-to-end (E2E) testing is an essential part of a software development lifecycle. This methodology is implemented using E2E test cases that validate the functionality and the performance of a software application. End-to-end testing is followed by functional and system testing.
Why is E2E testing needed?
Any application is a combination of several blocks of codes and APIs. When they work simultaneously, these codes may throw up errors, jeopardizing the key functionalities that make up the system like the buttons, links, form, page, etc.
But when an application is under development, the communication of the various codes and APIs underlying the functionalities are limited to the developer only. Hence, the chances of the application throwing up errors are also less. But when the same application is subjected to a live setting, it comes in contact with multiple users. As soon as the users start interacting with the different codes and APIs, the functionalities may begin to encounter obstacles. This may eventually result in the application going for collapse.
What is E2E testing?
To prevent the occurrence of such an event, what one can do is perform E2E testing with the help of testing scenarios. These scenarios not only help in authenticating the workflow of a system from start to finish but also mimic real-life user experiences. Therefore, one can safely pin their hopes on these end-to-end tests as they help to corroborate the data integrity and the integration of the components in the system. But one must remember that developing these end-to-end test cases requires a comprehensive approach as they are quite different from API test cases. While the latter can be tested against a set of well-defined business rules, the end-to-end test cases must deep dive into every operation of the application. This is to check how the system interacts with the following:
- network connectivity
- external dependencies
- and other applications.
This article will guide you on how to incorporate a reliable, accurate, and effective E2E testing regimen in your software development strategies.
What is the scope of E2E testing?
The purpose of E2E testing is to make sure that the user has a glitch-free experience while using an application. Understanding how to go about it is important to determine the success of this methodology. There are two ways of doing this:
- The first one is to go for a 100 percent coverage that involves testing all the different ways a user could use the application. This is undoubtedly a foolproof method as it would eliminate all the probable risks associated with using an application. But there is a downside to this process as it results in a huge testing codebase. Moreover, the testing runtime is also huge in this case.
- The next and the more practical one is to test the way a user would use the application in reality instead of going with all the possible scenarios. This method would give the company the highest value as it will reduce the runtime and improve the accuracy of the application. It would also remove the need for excessive data as user data would be sufficient in this case. The company also would not have to hire an expert to forecast the different ways a user might use the application.
The right approach can be suggested by experienced QA Engineers based on a thorough knowledge of the codebase and the business metrics of the web app.
What are the requirements of E2E testing that one should bear in mind?
There are some key requirements that one should keep in mind when incorporating end-to-end testing scenarios.
- Analyzing the requirements and having a fair idea of how the system is supposed to work.
- Setting up a testing environment in sync with all the requirements.
- Outlining all the hardware and the software requirements
- Determining how each system is supposed to respond
- Cataloging the input and output data for each system
- Zeroing in on the testing methodologies and the standards to be followed
- Devising ways to track the test cases and designing them
What are the bugs to consider?
End-to-end testing makes sure that when the user enters an application, they can execute all the steps needed to complete their task seamlessly. For example, if someone is using an e-commerce platform to purchase a product, they should be able to log into the system smoothly and then search for their preferred items. Once the list of items appears, they must be able to use the given filters to filter out their search results. The website should allow them to select the product and then complete the buying process. Each step in the process is triggered by back-end applications of which the users are unaware.
External Software Products
The way information entered by the users is encrypted, secured, stored, and the products are delivered, there could be involvement of external software products. These are usually cloud-based relationship platforms like Salesforce, etc., which help in managing the business data of the e-commerce company, while other marketing platforms like Marketo or HubSpot may manage their outreach strategies. In such scenarios, the e-commerce platform will need a firewall and a network in place to make sure the user information is not compromised. Plus, it also needs to ensure that information flows between all the external software products smoothly.
An Example of an E2E test case
This is an example of an E2E test case. It tracks a user's journey right from logging into an e-commerce platform to adding a product to their cart to buying it through an e-commerce app.
- Enter the URL of the e-commerce site into the address bar of the web browser and submit the same.
- Locate a product link on the Homepage and click on it.
- Click the "Add to cart" button.
- Validate the "View Cart" link and click on it.
- Navigate the checkout process and enter a name and address, and choose the payment mode, etc.
- Click Submit.
- Verify that the purchase is successful, after which an email confirmation will reach the inbox of the user.
What workflows to follow?
To minimize the risk of a bloated test suite that is high on both maintenance and runtime hours, it is best to divide the test cases into two groups. The lesser the runtime, the easier it is to test every build and provide feedback to the developer so that they can fix the errors quickly.
Core test cases
They involve testing the core features of a website that the users use frequently. Core test cases have a shorter runtime.
Edge test cases
These involve testing the features that the users use less frequently. But they may have a strong impact on the user experience if the functionalities collapse suddenly. So based on the business value, the testing team will need to select the cases. It is essential to write the edge test cases carefully for the edge bugs that take place. Otherwise, the test suites may become too bulky. If the runtime permits, the company should run both the test cases for every build. But in case that is not possible, they should at least run the core tests with every build. It's better to conduct the edge tests only occasionally to detect the edge case bugs, as running the edge tests is more time-consuming.
Types of Testing
The two ways to perform E2E testing are horizontal and vertical.
This is the most common type of end-to-end testing and is used across different applications. It involves testing not only from a user interface standpoint but also from the perspective of the interaction between different software systems across applications, as seen previously in the e-commerce example. These software applications could either be from a third party or be developed internally by the company.
As the very name suggests, it involves testing an application's architecture from top-to-bottom. Here, each sub-system is tested, which is independent of the other. Vertical testing is carried out till the granular level. This is followed by unit, API layer, and user interface testing.
Although both have different prerequisites and advantages, they help in achieving the same goal. Finally, it depends on which method is easier for a certain company to implement.
Pros of horizontal tests
Horizontal tests require testing the environments for the system and making sure that the sub-systems are created beforehand.
- Focus on tests from the user standpoint
- Catch issues before the application goes into production
- Make sure business logic needs are covered
Pros of vertical tests
Vertical tests are based on the following strategies and bring together all the stakeholders like the product owners, developers, and testers.
- Behavior-oriented development
- Test-oriented development
- Continuous testing
They offer the following advantages:
- Involve high code coverage
- Can be executed quickly
- Involve more focus
- Are more effective for safety-critical software
Who conducts the end-to-end test cases?
The task of conducting the E2E testing should be handed over to an independent team like the product team or the QA team. They should be people who have a clear idea about the entire application and a complete understanding of the user journey. However, knowledge of the underlying codes is not a must. The testing team has to only make sure that the users can use the application easily and comfortably. To execute a foolproof testing regimen, these teams normally follow the below techniques:
- They use tools and data to understand the user's journey in the application system
- They develop end-to-end test cases for them
- They write tests designed to detect the bugs users may encounter during their journey
- They also sometimes employ product analytics to trace the user journey
Writing end-to-end test cases
Testing should involve writing a series of scenarios based on the interactions on the page, for example, a button, link, form, etc. It is the task of the team to make sure that these functionalities exist on the page and that they work alright. Changes in the application on the DOM (Document Object Model) indicate whether these interactions have responded in the right way or not. So the testing team should look for these indications to determine the responsiveness of various functionalities. Also, the data used in the test, for example, an address or a variable, should be used to ensure it correctly returns that data.
How to measure the success of E2E testing?
It is important to know whether the time and efforts that have gone into implementing the procedure have been successful or not. So the below metrics can help gauge the success or failure of the E2E testing.
Tracking the preparation status of the test case
Visual graphs can be used for keeping a tab on the preparation status of the test cases. Graphical representation helps in understanding the original number of test cases that were planned and the ones that are being finally prepared.
Tracking the weekly progress
It is important to analyze the weekly progress of the test cases. This gives an idea of the number of test cases completed every week and also the ones that failed.
Tracking defect status and details
Keeping an eye on the bugs that are discovered on a week-to-week basis is also essential, whether those defects were closed or not and prioritizing them based on their severity.
Making test environment available
One must track the amount of time allotted for running the tests in an environment and the actual time spent in carrying out those tests in the said environment.
Automating E2E testing
The need to save time has led to the emergence of many tools that help in carrying out E2E testing. They are based on a test automation framework on which the test cases are written. But these tools are dependent on testers to identify what needs to be tested and then write the test case scenarios. But with advanced tools that use product analytics, user behavior can be identified that help in developing more effective test cases.
Improving user experience holds the key to business growth. So to make sure that the user has a seamless experience, it is mandatory to perform comprehensive end-to-end testing before the application goes into production.