test-driven-development-example
test-driven-development-example copied to clipboard
Part-07 confusion
Part 07 tells us the following:
* Run the tests and you will find that the test fails.
* It's time for the REFACTOR stage. Now that we have a
* failing test, we can go and improve our existing code.
And in Part 18, this comment appears:
* Since our tests are GREEN, maybe now is the time
* to enter the REFACTOR stage and try to improve our
* code.
Part 7 suggests the order is Red - Refactor - Green, while other parts tells us it's Red - Green - Refactor. Which is it?
Thanks!
Quiet late for this conversation but leaving a clarification here for others.
The paragraph before that suggests,
* You know what, though? I'm not all that pleased
* with our parse method. There's a fair bit of
* repetition in there.
To make it more clear, the suggested order for TDD is always Red - Refactor - Green - Improve - Green. The last two stages is what the paragraph above is referring to. This is in cases where new functionality is added or improvements are done.