Is There Profit In Creating Unit Tests?

Publish Date - 25th April 2022

Last Updated - 25th April 2022

Is there profit in creating unit tests?

It depends.

Early/Exploratory phase

The important lines of code in a project is the business logic.

At the start of a new project when you are exploring this business logic, testing is not useful. This has been my experience. Frosty App is in it's very early stages. 4 weeks ago, the application was completely different than it was today. If I had written unit tests four weeks ago, they would be useless today.

There is no value in writing unit tests too soon for startup/early stage projects.

Pre-launch

Before your customers uses the product, it's important that everything available works.

Writing tests for the most critical functions is a good idea. Automated tests allow you to test a wide range of functionality quickly. This is where testing is useful. It increases the speed of shipping features to customers.

If, for example, you only have 5 main features then you can test them manually. It's faster.

What About TDD?

There is a concept called Test Driven Development. The programmer starts a new feature by writing a failing test. Then, they write the logic for the passing test. Finally, they refactor.

I do not use this process. What does TDD have to do with shipping useful things to customers?

Nothing.