What types of tests do we have in software development? Let's understand the impact of unit, integration, and e2e tests.
We grouped our tests into functionalities, and now we need to understand how to divide tests by the context that they verify.
What are the types of tests?
Taking into account the area we are testing, the test can be divided into the following types:
- Unit tests
- Integration tests
- E2e tests
Unit tests are fast and precise. They are focused on a specific thing and answer concrete questions.
In the context of a pizza creation it will be the following situations:
Integration tests verifies cooperation. They are also quite fast. When we write them, we don't focus on specific things as in unit tests but on checking that "something" has been used as intended.
Instead of checking if the pizza size, color, and other, we can check if it was made according to the recipe in the book. Below is an example of such tests:
E2e tests focus on the user's perspective, not the implementation. They are technologically agnostic and usually execute for a long time (they operate on the finished application, not code fragments) .
Instead of checking what's going on in the kitchen, how the pizza is made and based on what recipe - we simply ask the customer what he thinks about the taste (the customer is our application).
As you might have noticed, mainly the context changes. We started with a single employee (code file), we moved to a communication perspective (several code files), and at the very end we left the implementation behind and simply asked the customer (application) what he thinks about our product.
That's the difference between the different types of tests. Don't worry, it will get into your blood in the next lessons.
If you enjoyed it, be sure to visit us on Linkedin where we regularly upload content from programming.
- 1. Basics
Grouping the tests
The usage of describe and it
The best practices for naming tests
Navigating the different types of software tests
- 2. Mastering unit testing
Project and tests setup
Unit tests review
React component testing
Snapshot testing in React
Understanding stubs in testing
Understanding mocks in testing
Creating testing fixtures
Using spies in React and Typescript
Mocking environment variables
Using dependency injection pattern to improve fixtures
- 3. Mastering integration testing
Understanding the integration tests
Using MSW library to remove implementation details from tests
Creating fixture for MSW to reduce boilerplate and setup
- 4. Mastering e2e tests