Testing forms an integral part of the modern software development flow. From customer facing acceptance tests to code-focused unit tests, automated testing is part of the fabric of a modern build process and deployment pipeline. But it's not enough that there are some tests: to be a help not a hindrance, tests need to communicate not just verify, and testing needs to be a development habit not an afterthought.
In this online course you will learn about good unit tests (GUTs) and test-driven development (TDD) by seeing what it takes, putting them into practice and reviewing what you've learned. What practices support readable and maintainable tests? What test pitfalls hold developers and products back? How do you make testing fun and not a chore? Join us to answer these questions and more.
The course is designed so that it can fit more easily with your other commitments for work and home. It is divided into four half-days over a week. Each session includes lecture, Q&A and hands-on coding exercises, as well as optional homework to help connect the days. The examples and hands-on exercises will use C++, but you don't need to be a C++ guru to take part. We can also discuss similarities, differences and challenges of unit testing across different codebases, with different frameworks and in other languages.
- What do we mean by unit test?
- How do unit tests fit into the testing and development landscape?
- Addressing common objections to and weaknesses in unit testing
- What do GUTs look like?
- The elements of TDD
- C++ unit-testing frameworks and features (Google Test, Catch and others)
- How to choose test data based on domain
- Test naming, partitioning and structure
- The anatomy of test cases and test suites
- Variations in TDD and the test-first lifecycle
- Plain ol' unit testing (POUT), defect-driven testing (DDT) and iterative test-last (ITL)
- Identifying and adjusting overfitting and underfitting tests
- Refactoring tests
- Common test smells
- Reasons writing tests can be hard, and how to respond
- Trade-offs between integration and unit testing
- Dependency management smells and techniques
- Mocks, stubs and other test doubles and C++ support for kinds of polymorphism
- Avoiding mock-overdosing (following Java-style mocking practices in C++)
- When to use values instead of test doubles
- Using lambdas and function objects to reduce use of full test-double objects
- Testing and legacy code