paint-brush
To Err is Human, to Test is Divineby@aspiiire
139 reads

To Err is Human, to Test is Divine

by AspiiireAugust 10th, 2021
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Testing allows us to check that every behavior is exactly how we have coded it. The beautiful thing about testing is that you are able to follow the exact point in which your function has problems. It helps your team understand more about the x or y function since you will have a descriptive name that gives the reader what you are testing. There are many types of testing. The one that I've described is a unit test. It focuses only on a single unit, and it doesn't care about the connection of your function with other parts.

Company Mentioned

Mention Thumbnail
featured image - To Err is Human, to Test is Divine
Aspiiire HackerNoon profile picture

We are humans, we forget, we make mistakes, we change things, ideas. This happens when we work solo, imagine when you are in a team!

When we add new features or edit previously written code, we can create some issues in the other part of the application. Wouldn't it be cool if someone could check for you that everything is fine or you have broken 3 modules of x or y class, function, or whatever?

Nah, it takes time

Yes, it takes time. For example, TDD takes a little bit of time, but if you count the time that you will not spend looking for bugs after you find that 50% of your application is broken, it is better. 

I would say that it will take a little bit of time in the beginning, but in the end will take less time. If you code without testing when you have a full production application when you add a new feature breaking parts of your application, I'm pretty confident that you'll have a harder time.

The beautiful thing about testing is that you are able to follow the exact point in which your function has problems.


Yes, you guessed it, this is the purpose of testing... We are not perfect. Testing allows us to check that every behavior is exactly how we have coded it. The function receives the same inputs and gives the same outputs; the overall application works as intended.

If you could catch minor problems before they transform into huge loopholes in your software - I think that it's fantastic. 

If you don't, a simple bug after days and days, weeks, months, more people working on the project, and you have to solve a huge problem that you could have solved by implementing some tests.

More tests, better quality

Another important benefit of testing - it helps your team understand more about the x or y function since you will have a descriptive name that gives the reader what you are testing.

How should I start?

I suggest you follow the Test-Driven Development process - before you write any function that you want to test, you begin by creating the test! You write a test for that function with the main goal that you want to achieve in your mind; then, you develop the function.

More?

There are many types of testing. The one that I've described is a unit test. There are many types of testing.

Unit Testing focuses only on a single unit, as the name suggests, and it doesn't care about the connection of your function with other parts.

This is it!

I've learned about testing from many sources that I cannot recall now, but one book that I remember for sure is Clean Code!

Watch my youtube video here:

Also published on https://priiimo.com/en/computer-science/tutorials/software-testing-why-testing-is-important/60f9b904274df431f0a52e5b.