- “Why do you want me to write wong code?”
- “Why is Red so important?”
- When do you stop to fake?
In the last 7 videos, I answered these and other questions about the “Red” and “Green” phases of the test-driven development cycle.
Today I want to do a short recap.
You are watching part 8 of a mini-series on the first two phases of the test-driven development cycle: Red and Green. Today’s video is a recap of the last 7 videos and some sort of conclusion.
Writing a good failing test and getting that test from red to green “correctly” is hard.
But there are some things you can do in the phases “Red” and “Green” of the “Red-Green-Refactor”-cycle to make your life easier.
My name is David. I am a trainer and technical agile coach with over twelve years of experience. If you like this video, subscribe to my channel to get more.
Question / Problem
I started this 8-part series by saying:
One of the first things you must learn when starting with test driven development - or TDD - is how to write a good, “red” test and how to make this test green.
And this is already harder than you might think.
And it is. When you want to TDD, you must learn to take small steps. To break up a large goal into tiny steps, where each of them brings you closer to that goal.
You must learn to write tests that fail properly. And to write code that feels “just wrong” when you never did TDD before.
You must learn what to do when you get stuck; That, when you wrote yourself into a corner, you cannot get out by only moving forward.
And every now and then, you will face problems. You will face even more problems when you are just starting with TDD.
Sometimes you experience problems immediately. Sometimes the problems come after months and many, many tests, and then it will be hard to get back on track.
But there are techniques you can learn that will help you avoid or mitigate those problems. You can learn and practice test-driven development.
In this series, I showed you techniques and tricks you can learn to get better at test-driven development. I showed you challenges you should consider when writing test or when working on getting a test from red to green.
I was talking only about the first two phases of the TDD cycle: “Red” and “Green”. Does that mean the “Refactor”-phase is not important?
Not at all. I think it is just as important as the first two phases, or even more. But when I teach TDD - in TDD Trainings or Agile Engineering Practices Workshops I see people struggle much earlier: When writing a test or writing production code.
And that’s why I was talking about those two things first. Only when you can write a good failing test and the smallest possible production code to get this test to green you can start to think about refactoring.
And if you liked this video, please subscribe to my channel and share this video with your friends and followers by using the share buttons below - That would be awesome!
Read / watch all parts of this series here:
- TDD: Red-Green Part 8: Conclusion
- TDD: Red-Green Part 7: Specific / Generic
- TDD: Red-Green Part 6: Triangulation
- TDD: Red-Green Part 5: Into a Corner
- TDD: Red-Green Part 4: List of Goals
- TDD: Red-Green Part 3: Why Red
- TDD: Red-Green Part 2: Wrong Code
- Red-Green Part 1: Introduction
- Red, Green, ... Part 0: All Posts