Why I Write Tests?

I write software which is used to manage sensitive information. It doesn't really matter what kind of information my software deals with. The only things that matters are

  1. Only authorized persons can access that information.
  2. The information must be correct at all times.

Also, often the first requirement is a lot more important than the second one. It makes sense. After all, no one wants that his information is not safe. Right?

So, what does this have to do with automated testing?

Keep on reading and you will find that out. During this blog post I will reveal the two most important reasons why I write automated tests.

1. I Want to be Trustworthy

Every time when I write code, I remember that my customer (and the users of the application) trust me. They expect that the application provides correct information to them. They expect that the information entered to the application is safe, and it cannot be accessed by unauthorized persons.

I want to be worthy of their trust.

The easiest way to achieve this goal is to write tests. The biggest reward for me is that I can run my tests at anytime, and I will know immediately that the application is working properly and that its information is safe. On the other hand, if there is a problem, my tests help me to find the problem and fix it.

If I wouldn't write tests, I wouldn't be able to get this kind of "realtime" feedback. If I wouldn't have any tests, the only way I could know that I haven't made any mistakes, would be to test the whole application manually.

That is not possible.

I write tests because I want to be known as the guy who didn't let his client down.

2. I Care About the Future

It is relatively easy (and natural) to test your code manually just before you commit it. Even though this is definitely a good thing to do, it isn't good enough for me. I write automated tests because

  • Automated tests prove that my code works in the future as well. Manual testing only proves that my code worked when I tested it.
  • Automated tests document the expected behavior of my code. This is extremely valuable information for the developer who has to maintain the application.

I have realized that nothing lasts forever. I might move to a different project, or get a new job.

That is why I want to ensure that the developers who look at my code long after I am gone have the information they need to maintain my code.

I write tests because I don't want to be known as the guy who didn't care about the future.

My Reputation Is on the Line

Software development is not cheap. That is why I want to do everything I can to ensure that I don't let my clients down. I think that every client deserves to get an application which solves the right problem and keeps its data safe.

If I fail to meet that goal, I will damage my client's business, my employer's reputation, and my own reputation.

I don't want to gamble with my reputation. Writing automated tests means that I don't have to.

3 comments… add one
  • HansiKrankl Feb 24, 2014 @ 8:30

    Hi Petri,
    great post as usual. Big fan of you.
    "... I will know immediately that the application is working property "... Meant properly?

    • Petri Feb 24, 2014 @ 10:41

      Yes. Fixed that typo. Thank you for pointing it out!

Leave a Reply