Almost every story of testing starts with Cohn’s Agile Testing Pyramid or most familiarly the Testing Pyramid. If we re-call the pyramid, at the base you have unit tests which occupy most of the tests and then integration tests, occupy the next highest while end to end tests at the top occupies the least.
If the game was played the other way round, you will end up in an anti-pyramidal pattern which would be quite unstable. Instability will lead to lots of maintenance overhead and would be costly.
Hence this leads us to the fact that our goal should be to have lesser E2E tests. Most importantly we need to have a solid and defined criteria to select the right candidates for E2E tests.
Let’s start with an example, we have application to register users with a form containing fields; First Name, Last Name, Email and Password.
· First Name, Email and Passwords are mandatory fields.
· First Name doesn’t accept numerals.
· Email should be valid.
· Password should have at least 8 characters with uppercase, lowercase, numbers, and special characters.
Most of the time, these validations are going to be tested at the E2E level. The issue is as the application grows, these kinds of tests grow rapidly and will be cumbersome to test and maintain. Hence these are not the best candidates for E2E.
So, the question is where should we test these? In the lowest level as possible, ideally in the unit level as automated tests.
Let’s now focus on “How to identify the correct candidate for end-to-end tests.”
🤝 If you enjoy reading stories like this and you want to support me, why not consider signing up for a Medium membership? It will only cost you $5 a month — and you’ll get access to all stories on Medium!
🍿 If you are interested in watching my video tutorials you can find me on Youtube — Testers Diary don’t forget to subscribe to get…