I believe I already know the answer, but I am not 100% sure, so just a quick question: What does Red/Green Testing actually mean?
I understand it as "Write your tests first, so that they all fail (= all red), then write your code and watch how each test turns green, and when all are green, you're fine".
I heard this in Scott's MVC Talk at Mix, so I do not know if this is an "official" term or if he just made it up. (Edit: Scott actually also explains it starting at 55:00 Minutes, and he made a good remark why he beleives in it)
A term that fills a lexical void, for the first “live” and independent performance of an act or process for which a person has trained for a long period of time.
Red Green Refactor is the Agile engineering pattern which underpins Test Driven Development. Characterized by a “test-first” approach to design and implementation, it utilizes very short development cycles to minimize leap-of-faith assumptions.
Red, Green and Refactor is the three phase of Test Driven Development and this the sequence that get followed while writing code. When followed, this order of steps helps ensure that you have tests for the code you are writing and you are writing only the code that you have to test for.
Let's Recap! The Red, Green, Refactor method consists of three phases: Red - write a test that fails. Green - implement the test-supporting functionality to pass the test. Refactor - improve the production code AND the tests to absolute perfection.
It does refer to TDD or Test Driven Development, but it would apply to each test. Write the test first, then write the code to pass the test. It would be wrong to write ALL the tests first. TDD is an incremental development approach.
The basic idea is no code is written before there is failing test (RED). When you have a failing test, then you write the code to pass the test (GREEN). Now you are ready to write the next test -- i.e., no new tests until all are green. Or refactor, as @Brian points out.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With