Trainings Details
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 in your build.
Tests help to make long-term product development cost effective rather than a cost centre, they underpin an effective and frequent delivery flow 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's not enough to just have some test code; poor quality tests can hinder development just as good tests can streamline it.
This training looks at good unit tests (GUTs) and what's involved in writing and maintaining them. Topics include thinking of tests as specifications, data-driven testing, test coverage, test strength, mocking (and not mocking) and test structure. The training will also look at different testing workflows, from plain ol' unit testing (POUT) and defect-driven testing (DDT) to refactoring-oriented software engineering and test-driven development (TDD). The format of the session is lecture-driven with questions, examples and demos using C++, Catch and GoogleTest. Examples will also be available for participants to work on in their own time.
Trainings Agenda
Agenda overview
- Benefits of unit testing
- What makes a unit test good?
- Test-writing workflow, from POUT to TDD
- Tests as documentation
- Reflecting the domain concepts in the tests
- Data-driven tests
- Understanding and misunderstanding code coverage
- Structuring tests according to state models
- Given/When/Then and Arrange/Act/Assert test structure
- Grouping and nesting tests according to Given/When/Then
- Test strength: overfitting and underfitting tests
- Dependency management and mocking
- Alternatives to mocking