If you read my blogs, then you definitely know I learned to build a full-stack application.
But to build an application and to build an application that is efficient, robust, and performs well under any circumstances are different levels of skills and engineering.
In this AI era, everyone generates code using AI and builds applications, but actual software engineering is never about writing code.
The real engineering is to build software that works under any conditions, gives the correct output, and is reliable and well-tested.
This one thought led me to explore things about testing.
Before building my project, I never thought about testing and edge cases.
I built the feature, and if it gave the correct output, then fine, my feature was ready and I moved on to build another feature.
I wrote hundreds of lines of code without any real value because the feature was not reliable, not robust, and did not perform well under critical situations.
Then I found out this is the difference between a senior developer and a junior developer.
I learned to build software, but I didn’t learn to think about edge cases, what if my feature faced a critical situation, and what about robustness.
I missed thinking about edge cases, critical situations, and robustness.
This is the thinking that differentiates a junior developer from a senior developer.
At this stage, I had one doubt, and the doubt was: if testing is important, then I want to learn testing deeply.
If you have the same doubt, then I found the correct answer.
To build reliable, robust software that works in critical situations, you don’t need to learn software testing deeply if your goal is not to become a QA engineer specifically.
Why did I say this? The reason is that you only need to know how to verify your feature in the way you want to perform the task.
During the development period, the cost of finding bugs and vulnerabilities in the feature is very low if the developer finds their bugs in the early development stage.
To overcome the maximum damage of the feature and save your resources, testing becomes very essential in the development phase.
Now I understand the real value of testing, so I need to go deep into testing and need to learn testing.
And I found out that the basic thinking of testing depends on AAA (Arrange, Act, and Assert).
Think like this: these are the main pillars of testing.
In testing, you first arrange your configuration related to the feature, define some inputs and dependencies.
This is called Arrange.
Then the next step is Act.
In Act, you execute the behavior of the feature using the configuration you created in Arrange.
Now the next step is Assert.
Assert means verifying whether the output of the feature matches your expectation or not.
Let’s take one example for that.
I want to test my function greaterOfTwoNumber().
Then my flow of the testing is like that:
// Arrange
// Import the Function for testing.
const a = 2;
const b = 4;
// Act
const result = greaterOfTwoNumber(a, b);
// Assert
expect(result).toBe(4);
This is the most basic example of AAA.
In the first step, we do all the configuration like defining inputs and importing the dependencies and functions or features for the test.
Now in the next step, we do Act.
In Act, we execute the behavior of the function or feature, and in Assert, we check whether the output is as per our need or not.
If the output is not as per our need, then the test fails; if we have the correct output, then the test passes.
This is the basic overview of the testing.
If I am wrong in any section, please drop your thoughts in the comments.
Top comments (0)