Intro
What types of tests do we have in software development? Let's understand the impact of unit, integration, and e2e tests.
Prelude
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:
Loading
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:
Loading
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).
Loading
Summary
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
10 minutes
Software testing
2 m
Grouping the tests
1 minute
The usage of describe and it
2 m
The best practices for naming tests
2 m
Navigating the different types of software tests
3 m
- 2. Mastering unit testing
38 minutes
Project and tests setup
3 m
Unit tests review
4 m
React component testing
5 m
Snapshot testing in React
4 m
Understanding stubs in testing
3 m
Understanding mocks in testing
5 m
Creating testing fixtures
4 m
Using spies in React and Typescript
3 m
Mocking environment variables
3 m
Using dependency injection pattern to improve fixtures
4 m
- 3. Mastering integration testing
12 minutes
Understanding the integration tests
4 m
Using MSW library to remove implementation details from tests
4 m
Creating fixture for MSW to reduce boilerplate and setup
4 m
- 4. Mastering e2e tests
8 minutes
Comments
Add your honest opinion about this article and help us improve the content.