Agile Event Session

Green Tests and Red Tests

This video content is for Agile Alliance members only

If you’re already an active member, please log in now.

To view this content, and gain access to many more valuable resources, conference discounts, and invitations to exclusive networking and learning events, please consider becoming an Agile Alliance member.

Abstract/Description

A central benefit of doing test-first development is getting a suite of behavioral tests to regress code and support refactoring efforts. But when doing test-first development in practice, many developers write too many tests and implementation-dependent tests that break during refactoring. They spend more time rewriting tests than refactoring code. The very practice that was supposed to allow them to safely make last-minute changes actually becomes an impediment to changing code. This is not a fault of TDD but rather how it has been applied. When doing TDD correctly, developers write green tests that assert against behaviors, are unique, and fail for only a single reason. Teams understanding this can then create a suite of unit tests that act as a safety net for refactoring code in the future. They may still need some red tests that validate specific implementation details as part of a Quality Assurance effort, but most test coverage will come from green tests that support refactoring. In this session, we’ll explore how to write green tests that are implementation-independent unit tests when doing TDD and how to use them to safely refactor code. Understanding how to leverage green tests that support refactoring code is key to enabling emergent design and supporting last-minute changes to code.

Additional Resources

Add to Bookmarks Remove Bookmark
Add to Bookmarks Remove from Bookmarks
Add to Bookmarks Remove from Bookmarks

Speaker(s) may be willing to present this session at local group meetings and other events.

Agile2021
Talk

More Agile Event Session Videos

Test-Driven Development in Cobol
Mainframes, like Mark Twain, may well say, "The reports of my death are greatly exaggerated." Mainframe systems have always been around, quietly processing 80% or more of financial transactions worldwide while people's attention was focused on colorf…
Technical Agile Coaching with the Samman Method
Samman is a method for people who want to make a difference and improve the way software is built. The focus is specifically on technical practices and how people write code, and it's the best way I know to help software developers to adopt practices…
Test-Driven Development in Cobol
Mainframes, like Mark Twain, may well say, "The reports of my death are greatly exaggerated." Mainframe systems have always been around, quietly processing 80% or more of financial transactions worldwide while people's attention was focused on colorf…

Have a comment? Join the conversation

Discover the many benefits of membership

Your membership enables Agile Alliance to offer a wealth of first-rate resources, present renowned international events, support global community groups, and more — all geared toward helping Agile practitioners reach their full potential and deliver innovative, Agile solutions.

Not yet a member? Sign up now