Should you write tests?

Should you write tests?

What is testing? Testing is a way to evaluate the application to identify errors, bugs or defects. The goal of testing is to ensure that the application functions as it is supposed to. Testing helps developers catch and fix issues before the app is deployed. If something requires constant manual testing, writing test and automating it will be a good thing.

There are different kinds of testing. Some of the ones that I know and have used are:

When should you test?

This is the most confusing part for me. I know writing tests will save time and will benefit in long run. But what can be categorized as apps that needs test?

Recent research on tests have led me to conclude what needs testing and what doesn't by asking myself following questions.

  1. Is the application big? Does it have complex features? Is there a lot of code?

  2. How often will the code change?

  3. What is the team size? Are multiple developers going to be working on same code?

  4. What is the timeline for the project?

If the project is small like static pages with some forms, skipping testing won't hurt. Even freelancing projects that require less time to complete doesn't require testing. If it's a project where only few developers are working on it and the code is not going to change much, then it's not necessary to test.

After figuring out if you need to write tests, there are few more questions that I am still unclear on. Do you write tests first and code later, or code first and test later?

Until now, I have only written code first and test later. But it is still unclear which could be the best solution. Maybe I will figure it out as I go, but for now, writing tests are good is my conclusion.

Yogisha Opinions: