Member-only story

Start writing tests as they were documentation

David Rodenas PhD
5 min readFeb 9, 2018

--

It is great to suggest people write tests. It is indeed a good idea, but it is not enough.

Writing tests is hard. Not because it is difficult, but because of people. People think that tests are pointless and consequently a waste of time.

There are terrible testing practices, many of them harmful. Worst practices occur when coders are forced to write tests (big companies, test-obsessed coders, quality policies). Many of them resulting from these practices are almost useless. They are just copies of production code or very rigid tests. These tests lack many of the expected properties of a test.

What should we expect from testing?

«But: program testing can be a very effective way to show the presence of bugs, but is hopelessly inadequate for showing their absence.»

— Edsger W. Dijkstra, 1972

Tests objective is not creating a bugs free system. It is an impossible task. Tests cannot effectively achieve that. However, there are many other objectives which are valuable.

Main tests objective is to make legacy code disappear.

--

--

David Rodenas PhD
David Rodenas PhD

Written by David Rodenas PhD

Passionate software engineer & storyteller. Sharing knowledge to advance our skills. Join me on a journey of discovery in the world of software engineering.

Responses (1)