Side effect of unit testing

Fabbook Life and Dev

After couple of years I realized that testing is a good thing and not necessarily for technical reason. A test suit can prevent regression and couple of bad surprise. But testing have a side effect on the way you develop application, let describe this side effect…

Improve understanding of what you are doing

The first side effect is writing a test, force you to describe what you are doing. It looks like nothing, but it force you to pause and ask yourself: “What am I doing?” If you can’t answer this question, it means you will to do more research on what you are doing. Once you can write your test chance are, that you understood enough what you tried to achieve. And now you can describe it with the test.

Focus and avoid distraction

Once your test is written, you need to write code in your application till the test get green. And by doing so you will only focus on one problem you tried to solve. And as long your test is not green you are not done. Easy right? You won’t be looking for new problem or optimization because your test is still red. Focus is something really powerful and I believe testing is one way to get some.

Self analysis

You will have a first taste of your own code and the method you try code. So even before writing any functional code you can see if the naming you are using make sense. The test contain what you tried to achieve as a title and the methods you using, you will realize really fast if it goes along or not you could be more critical with your own code by seeing how it looks.

No miracle just a new angle to see your code

Off course as I mentioned in a previous post, there is no miracle but with the time and by improving the quality of your test you will also experiment this side effect. What you think about? Did you experiment the same? Or do you have a different opinion on it? Let me know below.