No testing, too much testing, right on target
avatarFrancis Hamel
May 12, 2021

Here is one of the most frequent questions when doing front-end development: what are you testing, why are you doing it, and how do you make sure you don't overdo it?

Obviously, both extremes, too much testing or lack thereof, are to be avoided. Not testing is a very bad idea and, on the other hand, "over-testing" could be a problem we have to contend with if we lack experience and/or knowledge.

Having experienced both extremes, "over-testing" became a problem when my team brought in Cypress to test our interfaces without knowing exactly what we needed to test. This type of test is tedious to perform and arduous to develop.

Tests that took too long to run ended up discouraging our team, ended being ignored and creating technical debt. But who wants to run 20 minutes of testing to finally commit?

Faced with this problem, we wondered how we could have good test coverage without necessarily requiring many heavy UI tests. It turns out that we used these tests as acceptance tests and, by overusing this kind of testing, we turned the test pyramid upside down since we had a lot more UI tests than component tests.

Minions Pyramid GIF - Minions Pyramid GIFs
Pyramid Test

But how do you test business logic triggered by an interaction, like the click of a button, without UI testing?

With recent frameworks like VueJs and React, we have used technologies like Jest and Mocha, which we were already using to do unit tests, in order to also do acceptance tests. Thus, tests that load interfaces can be avoided with faster/smaller tests with the help of component tests. We have learned that one type of test does not necessarily correspond to a range or scope. With this logic, an acceptance test can be small.

Subsequently, UI testing was only used for cases where one could not test with Jest and Mocha. Thus, its use has considerably decreased and has allowed us to be much more efficient in our development.

And you, have you ever faced a similar situation?

avatarFrancis Hamel
May 12, 2021
November 9, 2023 • Sujet
The epic adventure of a coaching software

Last year, we finally decided to take the plunge and make our own software. We quickly realized that being your own client also comes with its share of challenges... But what a great adventure!

Read more
December 10, 2020 • Sujet
Because we have to start somewhere

Discover the reasons that drive us to share our thoughts with you.

Read more
View all posts

Want to talk?

Do you have an idea for a digital product that we could help you with? You just want to chat or you have questions? Please contact us, we will be happy to answer you!

We use cookies to ensure the proper functioning of our website and for research and development purposes to improve our products and services. By clicking 'Accept all cookies,' you consent to using our website with cookies.