Agile TDD and Refactoring
This information-packed and hands-on course shows developers and technical leaders how to apply Test-Driven Development (TDD) and refactoring, apply the most popular Open-Source frameworks for TDD and use them within a popular IDE. TDD is powerful and practical. It’s the practice of always writing test code before the code to be tested. In addition to the obvious benefit that tests actually get written and executed for most code, a more subtle but important effect is that when we start by thinking very concretely-with code-in the role of a calling client to the new application code before it is written, it clarifies our design and becomes a more fun and creative way to combine writing tests with application code. Hence, TDD is more than just testing-it is a kind of creative micro-design step.
In this course you will learn how to think in and apply Test-Driven design and programming, and establish it as a consistent method for your development team. You’ll learn and work with the popular TDD framework JUnit (if Java, or one of the other popular xUnit frameworks if working in another language).
TDD quickly leads developers to see the need for and value of reducing coupling in their code, and for techniques to break dependencies so that tests can be run quickly in isolation. Thus, a critical adjunct skill in TDD is learning how to create and inject alternate “test doubles” (fakes, stubs...). In this course you will learn how to create stubs, fakes, mocks, object factories/mothers, how to break dependencies, and how to apply dependency injection methods.
Learning how to break dependencies for testing in isolation is especially important in the context of legacy code; in this course you will to work with legacy code to “bring it under test” and apply TDD.
Refactoring is a disciplined design skill to improve the structure of code without changing its external behavior. And Refactoring is part of the TDD cycle. Thus, in this course you will learn the various “code smells” and the refactorings to clean them up. Refactoring depends on automated refactoring tools built into popular IDEs or editors, such as Netbeans, Eclipse, SlickEdit, or emacs; thus in this course you will learn to apply an automated refactoring tool. Finally, the course includes a brief introduction to the companion agile methods practice called Acceptance TDD—executable requirements with automated verification. You will learn about the popular FIT framework and the Acceptance TDD methodology.
What you will learn
- To apply TDD
- To break dependencies and create “test doubles” (fakes, mocks, stubs...)
- To inject dependencies with flexible techniques
- To separate test set up code into object factories or “object mothers”
- To identify code smells
- To apply refactorings
- To use an xUnit framework such as Junit
- To define acceptance TDD and know tools to apply it
- Test-Driven Development
- Method and motivation
- Writing tests first
- The TDD lifecycle
- Testing in an iterative and agile method
- Categories of TDD: unit, acceptance
- TDD tools and frameworks: xUnit...
- Testing in different architectural layers
- Unit TDD
- Practice with XUnit
- Code smells
- Refactorings, including Extract Method, Introduce Explaining Variable, and more
- Test Doubles: Fakes, Stub and Mock Objects
- Integration vs. unit testing
- Setting up the test environment
- Mock generation tools
- Object factories
- Object Mother pattern
- Dependency injection
- Continuous Integration and TDD
- Acceptance TDD
- TDD and Legacy Code
- Characterization tests
- The Legacy TDD life cycle