Tuesday 

Room 6 

09:00 - 17:00 

(UTC+02

1 Day

Program with GUTs

One of the greatest shifts in modern programming practices has been how programmers across many different domains, languages and environments have embraced unit testing. Good unit testing, however, is more than having a unit-testing framework installed and running.

C++
C
Testing
Python
Technique

Tests help to make long-term product development cost effective rather than a cost centre, they underpin the effective flow of CI/CD and reduce failure demand on a team. But the discussion of unit testing goes further than simply doing it: what makes a good unit test? It is not enough to have tests; poor quality tests can hold back development just as good tests can streamline it.

This session looks at good unit tests (GUTs) and different testing workflows, from test-driven development (TDD) to refactoring-driven development, whether the code you are testing comes from the past, from a prompt or direct from your fingertips. Examples will be in C++, C and Python.

Agenda
• Kinds of tests
• Test-writing workflow: POUT, ITL, DDT, TDD and more
• What makes a unit test good?
• Common test smells and failure modes
• Tests as documentation and specification
• Given/When/Then and Arrange/Act/Assert test structure
• Aligning tests with domain concepts
• Data-driven tests
• Choices and checklists for test data
• Understanding (and misunderstanding) code coverage
• Structuring tests according to state models
• Grouping and nesting tests according to Given/When/Then
• Addressing brittle tests and long-term skipped tests
• Test strength: overfitting and underfitting tests
• Improving the design of your code by listening to your tests
• Dependency management and mocking
• Alternatives to mocking

Kevlin Henney

Kevlin is an independent consultant, speaker, writer and trainer. His development interests, contributions and work with companies covers programming, people and practice. He has contributed to open- and closed-source codebases, been a columnist for a number of magazines and sites and has been on far too many committees (it has been said that "a committee is a cul-de-sac down which ideas are lured and then quietly strangled"). He is co-author of A Pattern Language for Distributed Computing and On Patterns and Pattern Languages, two volumes in the Pattern-Oriented Software Architecture series. He is also editor of 97 Things Every Programmer Should Know and 97 Things Every Java Programmer Should Know. He lives in Bristol and online.