Back to Blog
End to end testing: best practices and pitfalls

End to end testing: best practices and pitfalls

Martina Fabbretti

End to end testing is a testing method to ensure that behavioral flow of an application, as designed from start to finish, works as expected. It typically considers the most critical and likely business scenarios. The purpose of performing complete, thorough testing, from the beginning to end of the product-user interaction,  is to make sure that business processes function correctly across integrated systems.

Formulating a proper end-to-end testing strategy presents many challenges to organizations. Even more, if their goal is to automate such complex business processes.

In this article we would like to share with you the golden rules, to help you manage your testing costs while realizing the benefits of testing. Besides we share the common pitfalls you need to avoid. So let’s take a look at them in more detail.


Best Practices for E2E Testing

Keep an end-user perspective.

When it comes to test designing and creating test cases, think like an end-user. Focus on the features of the application, rather than its implementation.

It is a good practice to only include high-value paths in your test strategy, focusing on how end-users will go through the system to accomplish a business goal. Examples like users signing up to an e-commerce platform, creating new sales orders, or planning delivery at home or office. Those are the high impact scenarios that you have to include in your end to end testing. They are relevant to the end customers and they have a high impact on business objectives (e.g. revenue, quality, speed, etc.).

A good way to capture the user perspective is to make use of documents such as user stories, acceptance tests, and BDD scenarios if they are available. Get into the mindset of someone using the application for the first time and reply to some questions:

  • What is the user trying to achieve?
  • Is it easy and straight forward to find what he/she is looking for?
  • Can the user accomplish its goal in a few easy steps?

As much as we are big fans of golden rules above, at Qualibrate we recognize this is not an easy task for a tester alone. That is why we build solutions to also empower business users to create test flows by recording the actions they perform daily. Business users can bring the end-user perspective. And they can save your teams’ a lot of time in creating meaningful and relevant business scenarios.

Risk-Based Testing.

Risk-Based Testing (RBT) is a critical tool for categorizing your end to end business processes, based on business criticality. This is useful in several ways. First of all, you can segment functionality into priorities e.g. P1, P2, P3, P4. This allows you to create test plans and schedules focused on priority. You may decide in cycle 1 to test all priorities but during cycle 2 only to focus on P1 and P2 business processes. Also, you can ensure that, when entering a testing cycle that has tight deadlines, you focus the testing from P1 to P2 to P3 to P4. So, if you run out of time, you ensure you test the most critical processes first.

To determine a high-risk feature, consider both how likely failure is to happen, and the potential impact that it would have on end-users. A risk assessment matrix is a useful tool for identifying risk.

There are others but the most common risk profiles rely on these 2 questions:

  • What is the impact of failure? E.g. high risk would be impacting revenue generation or halting production.
  • What is the likelihood of failure? E.g. high risk would be a large number of interfaces within the process or a high level of customization/complexity.

Think of Amazon.com or Booking.com. What would be the impact of their systems not working, even for a few minutes? And customers from all over the world not being able to generate business on either platform?

Maintain the right order.

The main goal of a proper Quality Assurance process is to identify application errors at the earliest stage in the software delivery life cycle, where the cost of resolving is the lowest. Therefore, investing efforts in the unit and integration testing is paramount to maintain a solid and reliable software delivery process.

E2E testing is no less relevant to such an approach. It helps identify business process related errors which are difficult to find in earlier stages of the delivery process.  So, execute unit testing and integration testing first. Then, during the end to end testing, run your critical smoke tests first to ensure integrated applications are communicating as expected. Followed by sanity checks and other high-risk test cases.

When a single unit test fails, it’s quite easy to figure out where the defect occurred. As tests grow in complexity and touch more components of an application, the increase in potential points of failure makes it harder to debug them when a failure occurs.

Structure, organization, and a good understanding of business logic are fundamental in the end to end testing.

Manage your test environment and your test data.

Make your test environment setup process as efficient and consistent as possible. Ensuring the deployment teams have clear requirements for your test environments is critical for success. There is nothing more demotivating for a testing team than getting halfway through a testing cycle only to find out that an integrated component isn’t connected or has different data. Running a smoke test can ensure you check all integrated system components are up and running.

If possible, keep the staging environments as close to production as possible. For this, consider image backup of the production environment. And look to infrastructure as code or automation of your infrastructure to save time and reduce human error.

Once testing is completed, refreshing the test data (and possibly even taking a snapshot) is a good tip to ensure the environment can easily be restored to the state it was originally. This ensures that running another round of testing is much easier for everyone.

Specifically, on SAP, Qualibrate has joined forces with Attunity to provide a fully tested, fully documented SAP non-production environment. With scrambled, anonymized data in hours instead of months. That is handy for on-demand test data management and production incident fixes. For the use cases, have a look at the solution we built together.


Pitfalls

Let’s also have a look at the common mistakes that you can do while executing your E2E strategy.

Don’t ignore flaky tests.

More often than not, end to end test fails because of the environment and test data not being synchronized across them. Rather than an error in the business process itself. Common failures can occur when financial periods have changed, or stock movements have been made. But the test hasn’t taken this into account.

This can lead to ‘flaky tests’ that, if you are not careful, people will start to mistrust. And if they keep failing for what appears to be random reasons, the developers will see such tests as annoying instead of helpful. One flaky test could damage the reputation of your activities. Don’t forget that!

Isolate flaky tests, find out what is causing the issues and, if possible, engineer the solutions into the test case.  A good end to end test will set up the data it requires, use the data, and when possible clean it up at the end. This minimizes the chances of failure being related to the data and environments.

If you are automating your E2E tests, avoid the selector maintenance nightmare.

Even if this is a very specific tip for the companies who chose to automate their end to end testing strategy, we decided to include it as it can save you a lot of time maintaining your test scenarios.

If you are automating a web application, you will need to leverage stable selectors to locate the UI elements on the page. By selecting a stable selector you make sure that your test is not going to fail every release because your script was not able to identify the right object.

There are several ways to locate a UI element but not all of them are robust enough. It’s the case of CSS selectors: classes are liable to change, which means more tests failing because of it. You can use ID selectors: they rarely change, but they can sometimes.

The best option is to create a data-test=”unique_value” attribute. This is an attribute added to the target element, used only for test purposes. As long as the value is unique, the test will be able to find it. Also, most developers/UX people know they cannot mess with it.

Tests shouldn't depend on each other.

Each test should run completely independent and its result should not depend on the outcome of a previous test. Also, if you are testing a web application, make sure that each test starts in a fresh browser window with all cookies cleared.

What you want is to avoid the domino effect and that a single failure would cause too much redundant noise in your testing ecosystem: analyze your tests and get rid of dependencies.

Here is a very simplistic example:

  • Test 1: user logs in
  • Test 2: user is logged in and creates a new opportunity
  • Test 3: user assigns the opportunity to an owner

You might think that, by running these tests right after each other, you could save some time. However, if test 1 or 2 fails, the following will fail too. You've basically created a waterfall of failing tests.

So, make sure to avoid dependencies and to start in a brand new browser window.

Re-run tests before raising an issue.

As we mentioned above, E2E testing is complex and more likely to fail for undetermined reasons. If a test fails unpredictably from time to time and you have run out of ideas for improving reliability, try running it again. And again, and again. We suggest 3 times, just to be safe, before raising an issue.

Don’t expect it to be maintenance-free.

Running end to end testing is complex work. Don’t expect it to be maintenance-free. The more your application gets complex with added features, the more maintenance you will need.


Conclusion

Running E2E testing can be challenging but everything starts with a good test design system. Keep an end-user perspective and prioritize the scenarios with higher risk.

Take care of the quality of your test environment and your test data. Run unit and integration testing first. Make sure your tests are stable enough and get rid of the flaky tests.

Simple rules and best practices will make your strategy successful.

Share on social media: 

More from the Blog

You've been doing Business Process Documentation Wrong - Here's how to fix it

Your business process documentation should provide a solid and reliable reference point. Still, most projects get their business process documentation wrong. Let's look at some of the common issues and how to fix them.

Read Story

COVID-19 & IT investment - Prevention is better than cure

At a time when we are more reliant on our IT systems than ever - from helping our businesses to flourish, allowing us to work from home, shopping online, improving our lifestyles - how do we make our IT systems safer and more resilient?

Read Story

SAP Activate – What it is & Why You would use it?

What is SAP activate? Activate is SAP’s implementation toolkit. It is more than just a methodology. It’s not pure Agile, not really Waterfall, it is somewhere in between...

Read Story