Intro
We will go through the basics of software testing. We will find out what the magic tests are, when to use them and what we can achieve with them.
Prelude
In order to understand what application testing looks like, we need to learn the concepts from which testing is derived.
Question
Imagine a situation in which you are talking to a powerful AI. It's the year 2137, and all you have to do is ask a good question.... Exactly, but what does good mean?
In my opinion, it's a question that is short and specific. The kind you are currently asking in the GPT chat room. After all, by asking an overly complicated question before you get an answer, you have to ask more questions. It is much easier to ask one.
Of course, some problems are too complicated to be solved by a single question, so the problem should be broken down into smaller parts and to each of them ask a simple question - the divide and conquer methodology.
That's what software testing is. You should divide the problem if it is complicated into n parts, then ask specific questions and find answers to them.
Answer
People have been looking for answers forever. It's the same with testing. You look for answers to the questions you ask. Is the table flat? Is the earth flat? What will be the answers to these questions?
Of course, the table is flat, and the earth is not. However, if you go into the details, the table is not "perfectly flat" and the earth is not "perfectly round".
Here you can see the erroneously asked question. So the answer was also convoluted. Instead of hearing yes or no in the answer itself we had to resolve the doubts of the question...
As you can see the answers are dependent on the questions, not vice versa so before you start looking for them make sure that the question is the right one.
Divide and conquer
Let's suppose you work in a restaurant and teach a colleague to make pizza. How do you determine that your friend is making pizza the right way. The obvious thing is that you need to ask some questions and find answers to them ¯\_(ツ)_/¯.
- Is the cake brown?
- Is the cheese melted?
- Is the pizza warm?
- Isn't the pizza plate dirty?
- Did the pizza taste good for 90% customers?
The answer to each of them is actually yes or no. If all the answers are positive, it means that our colleague is "good enough" pizzerman.
Well, let's check it
We already have the questions so let's now look for the answers - let's play the role of the tester. To each question we will add a corresponding icon suggesting yes (✔️) or no (❌).
- Is the cake brown? ✔️
- Is the cheese melted? ✔️
- Is the pizza warm? ✔️
- Isn't the pizza plate dirty? ✔️
- Did the pizza taste good for 90% customers? ❌
During testing, it turned out that the pizza tasted good to only half of the customers, so our colleague needs training. We gave him a few days and we ran the same tests again.
- Is the cake brown? ✔️
- Is the cheese melted? ✔️
- Is the pizza warm? ✔️
- Isn't the pizza plate dirty? ✔️
- Did the pizza taste good for 90% customers? ✔️
All questions have a positive answer, so our colleague can start work.
Summary
This particular questions and answers are mythical tests. So, we can say that testing is nothing more than posing clear questions that can have only two possible answers (yes, no) and checking which answer it is.
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.
10/10