How much time does it take to write tests? A case study

A. Christofides, How much time does it take to write tests? A case study, EuroPython, Dublin, July 2022.

[doc_id=2223]

[English]

Writing automated tests takes time. As developers, we are constantly pressed by management to deliver early, which means we are tempted to skip writing some of the tests. Of course, in the long term, the time needed to write tests is paid off.

But how much of our time do we spend in order to write tests? Is it half? Is it three-quarters? This can be difficult to measure, particularly if we are using test-driven development, because in that case writing tests is integrated in the process of writing code.

While I like test-driven development, I can only practice it when I have a good idea of what code I want to write. But sometimes my idea of how to approach the problem at hand is quite vague and I experiment a lot. In these cases, I write the code first and the tests after that.

In one such case I first finished the functionality I was developing and proclaimed it "beta". I then went on to write the unit tests for it. As a result, I have a clear idea how much time I spent writing documentation and main code, and how much I spent writing tests. In this talk I examine the implications of all this.

PDF Full text (461 KB)

Remarks:

See also: https://ep2022.europython.eu/session/how-much-time-does-it-take-to-write-tests-a-case-study