What are we loosing when we are not writing tests for our code ?

md.warish Ansari
4 min readFeb 18, 2023

I have seen this issue in most of the new developers out there who are not confident or not even bothered about writing tests for their own code.

Main Problems faced by the developers

Photo by Elisa Ventur on Unsplash
  1. Lack of knowledge about the tests 🧐
  2. Feels boring while writing tests 😩
  3. Not aligned with their deadlines as they mainly focus on shipping their code to production as soon as possible
  4. Needs extra time apart from writing code 🕰️ 👨‍💻
  5. Feels like as it is an optional thing to have. If its there well and good and if not then no worries 😌

In this article we will not be talking about what are tests or its implementation , it will be an another article but rather will discuss the importance of writing tests and what we are loosing in absence of it.

Lets take an example of two persons named TestPerson and CasualPerson, both of them works in a same company , they both write code for their company and follow a structured manner of moving their code from Dev to Prod.

This process includes -

  1. Writing the Code
  2. Getting the code reviewed from other people
  3. Handing over the code to the QA(Quality Assurance) so that they can test your code in the real world scenario’s
  4. Pushing it to the production 🎉 🎊

CasualPerson writes the code, get his code reviewed and push it for the QA. Qa tests his Code filed some bugs and revert back to the developer again. CasualPerson modifies his code, make some changes and then again sends it back to QA thinking he has fixed all the filed issues but in turn what happens, QA finds that new issues were fixed but things which were working previously got broken, which in turn gives it out for another round of iteration.

This iteration will continue until every bug is fixed.

Highlights

  1. Multiple round of iteration back and forth between developer and QA
  2. QA time got extended
  3. QA lost their confidence on developers as they keep on testing things which were tested earlier and were working fine.
  4. Developers lost their confidence in sending their code to QA in fear of getting another things broken
  5. Deadlines are geting postponed 😞

Now lets talk about the TestPerson, how he handles all these issues.

  1. Writing Code
  2. Writing tests for his code
  3. Getting it reviewed
  4. Handling it to the QA

There is one major difference from CasualPerson process is writing tests for his code. 👨‍💻

When the code reach to the QA they do a thorough testing and filed some bugs. But in this case TestPerson can now only focus on the filed issues and dont even need to take care of the other working features, because this would taken care by the tests he has written. TestPerson can now know even before handling his code to QA if their are some issues with his code or by the new changes he has commited to the code.

Highlights

  1. Less round of iterations
  2. QA time got decreased
  3. QA developed a sense of confidence on the developer
  4. Developer has confidence on his code before pusing it to the QA
  5. Deadline is met 😃

We should wirte tests in every sort of manner, aiming for the long goal instead of thinking for the short term goal.

Testing is an important aspect of Software development, it is there for a reason and this is why good developers always tends to have this in their stack.

Hope you all like it, will be back with another blog till then

--

--