I have the impression that many developers don't automate tests.

This is just an observation. I may be wrong 🙂

In any case, I want to try to motivate the developers that are not into testing yet.

A thread 🧵 about 8 benefits of automated testing 👇
1⃣ Tests are the code samples of our system.

❓ Have you ever skipped an answer in StackOverflow because it didn't contain a code sample?

Code samples help us understand how things work.

🔑 A software system is easier to understand if it has automated tests in place.
2⃣ Tests are executable specifications of the behavior of the system.

Written documents become obsolete easily and they often lie. They specify what the system is supposed to do, not what it does.

🔑 Tests specify what the system *actually* does and they are always up to date.
3⃣ Tests give you the first users of your code.

When you are writing tests, you become a user of your own code.

If the design is bad, you are the first to experience the problem.

This makes you put more effort in refactoring.

🔑 Automated tests lead to cleaner code.
4⃣ Tests give you immediate feedback about runtime errors.

❓ Have you ever felt the pleasure of misspelling a variable name and getting immediate feedback from your IDE?

You can get the same kind of feedback about runtime errors, if you run the tests often enough.
5⃣ Tests prevent the occurrence of bugs.

When you write tests, you are specifying the behavior of the system.

As long as the tests are there, this behavior is preserved.

If, some time in the future, you change this behavior unintentionally, the tests will catch the error.
6⃣ Tests give you a safety net.

With a safety net of tests, you can refactor confidently, in a similar way to trapeze artists who perform without fear.

The more comprehensive the test suite, the better, because untested behavior are holes in this net through which you may fall.
7⃣ Tests have positive architectural implications.

To test a unit of code properly, you must isolate it, mocking its dependencies.

The more loosely coupled a system is, the easier it is to test.

🔑 Automated tests lead to low coupling.
8⃣ All of the above benefits together have an important consequence:

✨Automated testing increases software quality✨

And high quality is the only way we can have:

🔹 Huge savings in time and money.
🔹 Happy customers.
🔹 A motivated development team.
You can follow @macerub.
Tip: mention @twtextapp on a Twitter thread with the keyword “unroll” to get a link to it.

Latest Threads Unrolled:

By continuing to use the site, you are consenting to the use of cookies as explained in our Cookie Policy to improve your experience.