Writing good test code is not easy. In this workshop, I discuss:

  • The testing pyramid
  • Design for testability
    • Dependency injection
    • Ports and Adapters
  • Mocking
    • To facilitate testing (more control, more observability)
    • To explore boundaries (in a TDD fashion)
  • TDD
  • Test code best (and bad) practices
    • FIRST principles
    • Kent Beck’s test desiderata
    • Test smells
  • Test design patterns
    • Abstractions
    • Builders
    • Page Objects


  • Slides (QSP Labs, University of Innsbruck, 6/March 2020)

Reading material

  • Software Testing: From Theory to Practice, chapters on pragmatic testing.

  • Martin Fowler’s wiki: https://martinfowler.com/tags/testing.html. Simple to read and full of pragmatic advice!

  • Hevery, Misko. The testability guide. http://misko.hevery.com/attachments/Guide-Writing%20Testable%20Code.pdf

  • Meszaros, Gerard. xUnit test patterns: Refactoring test code. Pearson Education, 2007.

  • Freeman, Steve, and Nat Pryce. Growing object-oriented software, guided by tests. Pearson Education, 2009.

  • Beck, Kent. Test-driven development: by example. Addison-Wesley Professional, 2003.

  • Hunt, Andy, and Dave Thomas. Pragmatic unit testing in Java with JUnit. The Pragmatic Bookshelf, 2003.