Property-Based TDD Workshop at XP2013 and SPA2013
This June I will be running the Property-Based TDD workshop at the XP 2013 conference in Vienna and, with Keith Braithwaite, at SPA2013 in London.
This is a hands-on programming workshop to explore how property-based testing influences the TDD process and the designs it produces.
The TDD/BDD community has not embraced property-based testing, despite tools having been available for some time for most programming languages. TDD practitioners "triangulate" a property of the system by testing it against multiple examples, selected manually. This is not ideal. Triangulation does not explicitly define the property being tested, giving little scope for automating the selection of test data. People reading a test must infer the property from the data and name of the test, which can be difficult. It is easy to write tests with poor condition/decision coverage.
The property-based testing literature has focused on testing for quality assurance. It does not describe property-based testing tools being used to drive development, focus attention, measure progress, and obtain design feedback. A notable exception is Saff & Boshernitsan's article on JUnit Theories, The Practice of Theories: Adding "For-all" Statements to "There-Exists" Tests.
In this workshop we will investigate the intersection of TDD and Property-Based Testing.
How do we go from examples to properties? Must we start with examples and generalize to properties, or can we start with properties in some cases?
How do we change properties as the system grows? Do we start with general properties and specialize them, or specialized properties and generalize? How does that compare to adding examples?
Can property-based testing drive design? If we focus on properties, do we get different designs than if we focus on examples?
Are some design styles easier than others to describe in terms of properties?
Does property-based testing work better when working topdown/outside-in or bottomup/inside-out?
Note that this is a workshop, not a tutorial. I don't know the answers. I'm hoping we can find some out together.
The workshop is suitable for developers with experience of Test-Driven Development. If you want to participate, you'll need a laptop or to find someone to pair with who has a laptop.
You can use any language you like, as long as you can find a property-based testing library for it and somebody to pair with. People have used Python, Ruby, Java and C#. It would be great to see people using Haskell, ML, F# or Scala.
If you can, try doing Keith Braithwaite's TDD As If You Meant It exercise beforehand, so we can compare and contrast doing the same exercise with different kinds of testing.