DDD Europe 2022 - Program

Introduction to Approval Testing


Emily Bache

Emily Bache

(This is a hands-on lab with limited capacity)

Approval testing is a technique that helps you to get a difficult codebase under test and begin to control your technical debt. Approval testing works best on larger pieces of code where you want to test for multiple things and interpreting failures is challenging. In this hands-on session we'll introduce a commonly-used Approval testing tool for Java and through hands-on exercises learn to get control of some example code. The same tool is also available for many other programming languages, and the principles of test design are what we will focus on. See https://approvaltests.com/.

Session outline:

Introducing Approval Testing (55 minutes)

  • Code Review: examine existing test case, discuss strengths & weaknesses
  • Demonstration: Convert an assertion-based test to use Approval testing
  • Hands-on exercise: Add some tests using Approvals.Java.

Break (5 minutes)

Approval Test Design (50 minutes)

  • Presentation: Approval testing characteristics and design patterns
  • Exercise: Using the default XML printer with Approvals.Java
  • Demonstration: Using scrubbing with an XML printer
  • Presentation: when to print, when to scrub

Q&A (10 minutes)

Hands-on prerequisites

Bring your laptop with a modern browser like chrome. Bring a separate keyboard and mouse if possible to enable pairing.

About Emily Bache

Technical Coach with ProAgileTwitterLinkedInBlogCompany Website

Emily is a Technical Coach with ProAgile. She has worked with software development for over 20 years in diverse organizations from start-up to large enterprise. These days Emily specializes in coaching development teams in agile practices like Test-Driven Development, refactoring and agile design. Emily has written two books, authored Pluralsight courses and regularly speaks at software conferences. Originally from the UK, she currently lives in Gothenburg, Sweden.