Skip to main content

Posts

Showing posts from March, 2022

Phases of TDD - Learn by example

I have already written on getting started with TDD . Let me extend it further and mention in theory what are all the phases involved in a TDD. Before jumping into this article, I hope you read the getting started with TDD article.   There might be more steps involved in TDD. However we're just going to discuss the phases of TDD and what do we do in each phase. /**  * @disclaimer  * I'm just preaching what I have learnt & practice   * Some parts of it could be wrong  * Please feel free to leave comments if am wrong  * And I would be happy to stand corrected */ The three phases of TDD are the, Red phase Green phase Blue phase Red phase This is the very first phase in TDD where we write a test for it to fail.  Green phase This is the second phase and immediate next phase to red phase where we write code for the test that we just wrote in the red phase to pass.  Blue phase This is the third and final phase of a test where you refactor the test to simplify it down further. Thes