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.
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