Learn how to use unit tests to specify behavior for the code you want to build so that your tests support refactoring code and communicate intent.
Test-driven development is supposed to help us refactor our code safely but we often find that when we refactor our code we also have to refactor our tests, and what was supposed to add safety becomes a burden, requiring time and effort to keep code and tests in sync.
Writing good unit tests is a critical skill that teams need to master in order to get the most benefit from test-driven development. Tests must be unique, written at the right level of abstraction, and implementation-independent in order to be most valuable.
In this session, we’ll cover effective techniques for doing TDD that support building useful tests and quality code. You’ll learn how to approach TDD in a way that yields the right number and kind of tests to support refactoring. Working through a few code examples, we’ll see how many assertions are required to specify a linear range, exceptions, and other boundary conditions. We’ll look at how to write tests that don’t need to be changed when code is refactored while still keeping test coverage high. If you’ve struggled to apply TDD on a project, or are just not sure how to start, then this session is for you.