DEV Community

Cover image for Why testing is important?
Aspiiire
Aspiiire

Posted on • Originally published at priiimo.com

Why testing is important?

Testing is by far one of the most important things to do during programming, but it as well one of the most overlooked things.

Testing ensure that you have a well working Website, Application or Software, let me explain.

Why Testing is important?

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

When we add new features or edit previously made code, to be clear, when we touch stuff, sometimes you can create some issues in the other part of your application;

Wouldn't be cool if someone could check for you that is everything fine or you have broken 3 modules of x or y class, function, or whatever?

Nah, it takes time

Yes, it takes time, following 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 you application is broken, it is better. 

I would say that it will takes a little bit of time at the beginning, but at the end will take less time.

Instead if you code without testing when you have a full production application and, for example, you add a new feature breaking parts of you 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.

Process of testing illustration

Yes you guessed it, this is the purpose of testing...

We are not perfect, testing allows us to check that everything is as it was before nothing has changed and every behavior is exactly how we have coded it before, 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 in huge holes in your software in the same moment you create them I think that it's a fantastic news. 

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

If you cover a well amount of your Application's modules, you can be pretty confident that you have a well working Software, that means that the quality is better since your double check everything. 

Another important benefit of testing, is that helps you and other to understand more about x or y function, since you will have a descriptive name that give the reader what are you testing.

How I should start?

I suggest you to follow the Test Driven Development process always abbreviated as TDD;

It works like this, first before you write any function that you want to test, you begin by creating the test, yes before even the actual thing that you want to test exist.

You write a test for that function with the main goal that you want to achieve in your mind, then you develop the function.

Probably you would not expect this point when you follow TDD but it helps you to be more productive!

Probably you would not expect this point when you follow TDD but it helps you to be more productive!

More?

There are many types of testing, the one that I've described is defined as 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, in which you should follow another type of testing, for example, Integration Testing.

This is it!

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

I link a referral here, if you prefer the digital version, I suggest you to get a bundle by the author of Clean Code and Clean Coder at a lower price.

---- US ----

---- IT ----

Thank you for reading 😀👋

I hope that you enjoyed the content and it was nice to read, inshAllah in the future I want to release a more specific example about testing, with Flutter and Javascript.

If you want to follow me on other socials here I'have some links...

Youtube
Twitter

Top comments (0)