What is red/green testing?

前端 未结 3 699
鱼传尺愫
鱼传尺愫 2021-02-19 16:41

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 f

3条回答
  •  天涯浪人
    2021-02-19 16:50

    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.

提交回复
热议问题