Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage Presentations Property-based Testing for Better Code

Property-based Testing for Better Code



Jessica Kerr shows the charm of autogenerated test data, the beauty of expressing only what matters, and the challenge of stating what you need without repeating the code under test using ScalaCheck. Property-based testing isn't only for more tests with less code. It's about constraining your implementation in all the ways that matter and fewer of the ways that don't.


For more than a dozen years, Jessica Kerr toiled at enterprise software in Java and C. Two years ago, the promise and intrigue of functional programming led her to Scala. When she isn't speaking about at development conferences in North America and Europe, she works in Clojure at Outpace.

About the conference

Software is Changing the World. QCon empowers software development by facilitating the spread of knowledge and innovation in the developer community. A practitioner-driven conference, QCon is designed for technical team leads, architects, engineering directors, and project managers who influence innovation in their teams.

Recorded at:

Oct 19, 2014

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

  • Interesting

    by Guillaume L,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    Overall an excellent talk. I don't agree with everything that is said about isolated unit tests though. Particularly that they don't test the seams of your system. Indeed, there is a whole range of test doubles (mocks, spies) precisely designed for that purpose. What's more, this very lack of seam testing could be reproached to the technique explained around 00:40 - when you fake the database, you don't test the seam between the real database and your system.

    Also, example-based tests do carry a notion of what's important - it's in test names. Naming your tests after the example values used in them is effectively stupid. Just because they are example-based doesn't mean you shouldn't think about a more general meaning of your tests. Admittedly, property-based testing takes that to a whole other level by condensing all examples that obey the same rule down to a single test.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p