Chapter 1.4: Testing strategies: Unit testing 🤑
Unit tests are fast, easy to write, and easy to maintain. But what are the potential downsides, and why should we not rely solely on unit tests?
Unit tests are primarily one thing: fast. Writing unit tests is comparatively straightforward, and they provide rapid feedback. And if we follow certain best practices, maintenance is also effortless. But unit tests can only test certain aspects of our application. As the name suggests, unit tests test the functionality of a single unit, i.e., a usually small part of our application, in a vacuum.
I value your advice!
What is your opinion regarding the correct ratio of unit tests to acceptance tests?
Let us know in the comments!
I want to point out that not the technology is the deciding factor when differentiating unit tests from acceptance tests, but what we test and how we test it! Tests executed with Jest and vue-test-utils
are not necessarily unit tests! And tests run by Cypress are not necessarily acceptance or E2E tests either. With these tools, we can test individual units such as components, but at the same time, we can use both of them to test complete pages as well.
Keep reading with a 7-day free trial
Subscribe to Good Tests for Vue Applications to keep reading this post and get 7 days of free access to the full post archives.