What is End to End Testing? A Beginner's Guide
Getting started with end to end testing? Here's everything you need to reap the benefits whilst avoiding the time/resources burden E2E testing can impose
End to end testing can be one of the most valuable tools in your testing toolkit - if you use it correctly.
The right amount of end to end testing at the right time provides a super useful 'bigger picture' perspective. It's also great for testing out whether the business logic behind your app is sound, and that everything makes sense from a user point of view.
Rely on end to end tests too much, however, and you'll soon find yourself considerably poorer, time and resource wise - and you'll still be none the wiser about why your code is bugging.
Want to really reap the rewards of end to end testing? Read on for everything you need to know about what they are, when to use them and how to save days' worth of time when you execute.
What is End to End Testing?
End to end testing (often snappily abbreviated to 'E2E') is the process of validating your application and its dependencies from start to finish.
In other words, you're testing the interface of your product from a user perspective. Does it do what it is supposed to do without bugging? How easy is it for users to complete specific actions? Do all the elements appear as you think they should?
To do this, you'll need to create an environment identical to the real, post-launch environment that your customers will experience once everything is live. You can use this to test a variety of real-world 'user flows' - for example:
- Logging into a website
- Placing an item in a virtual cart and checking out
- Opening a paid subscription to your app
- Upgrading plans or managing account info
What are the Advantages of End to End Testing?
End to end tests are trickier and more time consuming to run than smaller tests
- so why do so many organizations see them as an irreplaceable part of their testing cycle?
Ultimately, it has a lot to do with their ability to give a user-centered, 'bigger picture' view of your application that you won't get by testing the code in smaller chunks. For startups, tech giants and everyone in between, E2E testing:
- Offers a genuine user perspective: some defects only become apparent when looking at the bigger picture. Testing from the perspective of an end user, rather than a developer, is vital for identifying these defects.
- Validates business logic effectively: E2E makes sure the workflows and logic that underpin your software work effectively from your user interface.
- Expands test coverage: E2E testing ensures your application's dependencies work together - including any third-party code your app might include.
- Reduces errors found in production: E2E tests work well as a sort of final check for your app, reducing the risk of bugs slipping through to the production phase.
What are the Disadvantages of End to End Testing?
There are a couple of things to be aware of when planning and executing end to end tests - especially if you're doing a lot of them:
- Slow: As they are more extensive, E2E tests take a long time to run.
- Challenging to automate: E2E testing scripts are complex, which can result in flakiness.
- Expensive: It takes a significant amount of resource to set up and maintain an E2E test environment.
Crucially, it's also very difficult to identify the root causes of any issues that crop up in end to end tests. If you're testing horizontally (see below), you're not testing individual blocks of code - you're testing the application as a whole. This means that it's vastly more tricky to pinpoint what's up and how to fix it.
These disadvantages are minimized if you're smart about what you test, when you test, and how you test it. With the right approach and the right tools, you can save days' worth of time on end to end tests whilst maxing out on all the advantages it offers.
Want to know how? Keep reading.
When to Use E2E Testing
To put end to end tests in context, let's take a look at a concept devs call the 'testing pyramid'.
<Insert testing pyramid graphic>.
You need a lot of the tier along the bottom, and very little of the tier on top. In this case, you need:
- Lots of unit testing (quick tests on individual code units to avoid), completed as you go in the main development phase
- A medium amount of integration testing (testing how code components interact with each other to make sure everything is playing nice) throughout the development phase
- A small amount of end to end testing towards the end of the development cycle, after development has wrapped
You should only start your end to end tests once the development phase is complete and you have tested your code extensively with smaller unit and integration testing.
How to Run End to End Tests
You can run end to end manually - by getting your developers, testers or external QA team to perform a series of actions on a staging version of your app. Alternatively, you can automate them by preparing test scripts.
Whilst human input is useful at this stage, traditional manual testing methods are time consuming, resource intensive and slow. Automating your E2E testing will save you time at a critical point in the development cycle - but bear in mind that doing so can be complex, so you'll need time to build good scripts for it.
Whichever option you choose, the process of running the test will be similar:
- Planning: choose what to test, build a schedule, and identify any other critical tasks
- Design: create your test cases and write any scripts you need
- Execution: run your tests, document the results, and log any issues
- Results analysis: analyze the results and fix any documented issues
- Repeat: repeat the test to check issues have been fixed, then ship code to production
What Should You Test in End to End Testing?
First things first: testing your entire app will be hugely impractical from a time and expense point of view. Prioritization is key.
What to prioritize? Start with these two categories and make an ordered list:
- Flows that will be most commonly used. If everyone that ever uses your app needs to authenticate their registration via email, that should be a prime candidate to test.
- Business critical processes that need to work, from a functionality and a commercial point of view. For example, if your checkout process is wonky, it's not just irritating for users - it stops the app generating any revenue.
Horizontal vs Vertical End to End Tests: What to Use When?
Horizontal end to end tests focus on complete testing of each stage of a user flow. You verify each step of the process, focusing on the interaction between different parts of the application and checking any state changes that need to take place.
Whilst potentially time consuming, horizontal tests are simpler to run than vertical. They're a great choice for testing multiple flows - prioritize the flows used most by your customer base.
In a vertical end-to-end test, you test a particular software component at every level of the testing pyramid. You'll perform unit tests and integration tests on a section of code, before verifying the component's behavior when customers interact with it.
Due to their complexity, vertical tests are normally used for a smaller number of business critical components. What makes this method of testing especially handy is that you can add these tests to a CI/CD pipeline, so you can test your most critical functions on every code commit.
Codeless E2E Testing: the Best of Both Worlds
Let's say you wanted to keep the 'human' element of end to end testing but the efficiency of automation. Let's also say you wanted to avoid sinking time into writing lots of complex test scripts.
It's not a pipedream - such a world is possible, and it is possible now.
Low code test editing tools use AI to minimize the amount of coding you need to do to automate end to end tests. And, if you want to run some tests manually, you'll be able to interact with your app as a user would, without time spent setting up complex testing environments.
The best low-code test editors allow you to:
- Access prebuilt checks that you can run instantly against your software
- Use AI assertions to test component behavior - type in what you want to check in English, no code required
- Automatically adapt tests to to changes in the UI without flaking
- Import or customize your own scripts to run in the tool
- Test manually, on a schedule, via API, or via CLI
- Test in any environment (locally, any URL, and in CI)
- Test flows involving email or SMS without complex coding needs
- Get AI powered accessibility audits and suggested fixes
The time low code editors save your team is staggering. And given that one of the biggest hurdles to overcome during end to end testing is the time drain and complexity of automation, they could just be the key to getting the most out of E2E with nearly zero of the drawbacks.
Momentic: Your Engineers' Software Testing Cheat Code?
“Momentic makes it 3x faster for our team to write and maintain end to end
tests.”
Alex Cui, CTO, GPTZero
We'd love to see if Momentic's AI testing tools could help you optimize your software testing life cycle.
If, like Alex and his team, you're keen to save over two thirds of the time you spend on key testing processes, why not schedule a conversation with our founder, Wei-Wei Wu?
Published
Dec 2, 2024
Author
Wei-Wei Wu
Reading Time
9 min read
Sections
- What is End to End Testing?
- What are the Advantages of End to End Testing?
- What are the Disadvantages of End to End Testing?
- When to Use E2E Testing
- How to Run End to End Tests
- What Should You Test in End to End Testing?
- Horizontal vs Vertical End to End Tests: What to Use When?
- Codeless E2E Testing: the Best of Both Worlds
- Momentic: Your Engineers' Software Testing Cheat Code?