Test Desiderata

Kent Beck described the concept that tests had a number of properties, and arranged them in a list. Not all tests exhibit all properties, but Kent stated “No property should be given up without receiving a property of greater value in return.”

Learning Objectives

Session Outline

Connect

On a post it note write the names of some types of tests that you know.

We would expect that many members of a team can come up with Unit Test and Integration Test.

Would anyone think of Contract Test, Exploratory Test, Smoke Test, Beta Test?

Concept

Introduce the Test Desiderata

Desiderata – (Latin: “desired things”).

The Test Desiderata

Image by Kent Beck

Properties of the Desiderata

Kent Beck describes each of these properties:

Show how a Unit Test meets many of the properties, although acknowledge that it lacks Predictive capabilities.

A visual example of Unit Test lacking inspiration and prediction properties

A number of memes exist to demonstrate this:

Unit Tests With No Integration Tests

Examine how the manual exploratory testing approach sacrifices almost all of the desired qualities, in return for greater confidence. (You may ask is that promise guaranteed?)

Quote

A Quote from the article by Kent Beck is worthy of attention:

Some properties support each other. Automating tests makes them faster to run. Some properties interfere with each other. Making tests more predictive of production behavior makes them slower. Sometimes (and this is the magic), properties only seem to interfere. You can use composability to make tests faster and more predictive.

Concrete Practice

Take some of the types of tests from the post it notes and allocate one or two to pairs in the group.

Ask them to review each of the properties on the Desderata image and decide which of the properties apply to these types of tests.

Conclusion

In a 2019 article published on Medium.com Kent Beck offers a great question to use as the conclusion to the Learning Hour:

Look at the last test you wrote. Which properties does it have? Which does it lack? Is that the tradeoff you want to make?