Sustainable Test-Driven Development
Listen to consultant Scott Bain on Sustainable Test-Driven DevelopmentCourse Objectives
This TDD training course teaches participants the sustainable approach to Test-Driven Development. After the course, participants will:- Know how to analyze requirements to obtain better tests
- Know how to write unit tests
- Know how to use mock objects
- Know how to refactor legacy code
- Know why and how to be "test-driven"
Description
The practice of Agile Software Development requires, among other things, a high degree of flexibility in the coding process. As we get feedback from clients, stakeholders, and end users, we want to be able to evolve our design and functionality to meet their needs and expectations.This implies an incremental process, with frequent (almost constant) change to the code we're working on. Each change is an opportunity to make the product more appropriate to the needs it is intended to address.
This course teaches the skills of unit testing, refactoring, and incremental development, but we take it farther than this. Unless developers are trained about which tests to write, how to write them, when to refactor code, and techniques for breaking dependencies, testing can become unsustainable as projects mature.
We teach sustainable test-driven development, with a focus on deriving maximum value (technical and business) from minimal effort and cost.
Course Level
IntermediateCourse Outline
Day 1: Techniques
- A brief overview of the motivations behind Agility, and TDD specifically
- As a group, we all get the testing framework up and running on all needed machines.
- Review Code Qualities, and how they relate to Testing and Testability
- Unit-testing in general, leading to the benefits of TDD
- A small Unit-testing/TDD exercise
Day 2: Design
- Mock Objects, with an exercise
- Code Smells, and Refactoring
- Refactoring to the open-closed, just in time design
- Legacy code refactoring exercise and debrief
Day 3: Reality
- TDD and Design, revisiting the exercise from Day 1
- TDD and Design, putting it all together. This includes a larger hands-on lab project.
You learn how to
Students learn to use an XUnit testing framework (Junit or NUnit or CxxTest), learn a variety of refactoring techniques, with hands-on exercises to solidify this knowledge.Finally, the practice of Test-Driven Development, which utilizes Refactoring and Unit Testing in a particularly fine-grained way, is demonstrated. A hands-on TDD project will dominate the third day.
Target Audience
Software developers who want to learn how to code better and learn new design techniques.Room Setup and Equipment Needed
A laptop or desktop computer with XUnit installed and an IDE with which they are comfortable working is needed for every pair of participants. Students will sit in pairs, and so tables sufficiently large to accommodate this are needed. The instructor requires a whiteboard or flip-chart, and an overhead LCD projector.Prerequisites
Participants should have a solid background in an object-oriented language such as Java, C#, or C++. They should have at least minimal proficiency with the language of the course, which is usually Java or C#. (The course can perhaps be given in another language or combination by prior arrangement.)- Anyone weak in object-orientation should read Part I's "An Introduction to Object-Oriented Software Development" Chapter 1 "The Object-Oriented Paradigm" from Design Patterns Explained: A New Perspective on Object-Oriented Design (Second Edition)
- Anyone who doesn't know the UML should read Chapter 2 "The UML—The Unified Modeling Language" from Design Patterns Explained: A New Perspective on Object-Oriented Design (Second Edition)
In addition, students who have not taken our Design training (Design Patterns Explained, or Design Patterns for Agile Developers) should view the following recorded presentations prior to addending this course:
- Code Qualities: http://www.netobjectives.com/resources/webinars/code-qualities
- Advice From the Gang of Four and the Strategy Pattern: http://www.netobjectives.com/resources/webinars/gang-of-four-strategy-design-pattern