Session

Embracing the Red Bar: A technique for safely refactoring your test suite

Have your tests become brittle? Have you strongly considered dumping your test suite and starting over? Don’t throw them away. Refactor them. But you need to be careful so that you don’t introduce false positives. We’ll explore a method of refactoring your tests that makes sure they still work.

Outline
Reasons why your test code should have same high quality you insist on for your production code
Normal TDD cycle
Red, Green, Refactor
Designed for production code
Ensures that your test only passes as a result of the code that you write
Allows you to safely refactor your production code without worrying about introducing failures
Risks of changing your tests without watching them fail
Red-bar Cycle
Red, Refactor, Green
Mutate the production code - produce the red bar (your test is failing)
Refactor your test - continue to see the red bar (your test continues to fail)
Reverse the mutation - bar should switch to green (your test should now pass)
Designed for your test code
Ensures that your test code continues to detect the failure condition that it was designed to
Walk through a live example
Learning Outcome
A technique for safely improving the quality of your test suite without introducing false positives.

Target Audience
Developers, Testers

M. Scott Ford

Chief Code Whisperer at Corgibytes

Actions

Please note that Sessionize is not responsible for the accuracy or validity of the data provided by speakers. If you suspect this profile to be fake or spam, please let us know.

Jump to top