TDD Cycle
- Red Test
- Just write the unit test.
- There is no code, no supporting code.
- However, in order to simulate the test, it is necessary to generate all the artefacts that would be required in the actual world. Therefore, this helps in the development of our initial API or code design concept.
- Write Code for Test
- Write the code to match the test that we have written. So we wrote a test to match the requirement. Now we're writing the code to match the test.
- Green Test
- Then the ultimate outcome of this would be that we write the code to match the test and we test again and get a green test.
- As a Negative scenarios - We compose the code and subsequently retest it, and it is expected that this test will fail. The code that we have written will now satisfy the requirement for which the test was written.
Repeat and Refactor
as we continue to do so and our requirements expand or our comprehension of the necessary implementations improves, This process is repeated and refactored.