Intro
Let's understand the testing syntax by providing metaphors and referring to real life. We'll understand the concepts of testing.
Prelude
It will be difficult for a computer to understand plain text, so we need to convert our grouped tests into something that a computer can understand.
Converting the syntax
Let's convert one of the features created earlier. Typically, most testing tools use blocks describe and it to describe tests. Describe means functionality, and it means a specific test. We will make the following transformation:
Loading
Loading
Note that we have moved from questions to assertions. The reason is simple - less text is produced and it is more intuitive to read. Also, if it is possible to simplify an assertion to a shorter form, it is worth doing (see Pizza plate is clean).
Summary
We know how to communicate with the computer and show him how to mark our tests. However, we still have some things to understand before we write implementations for our tests.
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.