What are the pitfalls of test after development?

前端 未结 3 1786
闹比i
闹比i 2021-02-06 07:56

Recently I was assigned to a project which was already in its midway. It was TDD environment. Everyone was following right principle of Code Unit Test First and Implementation

3条回答
  •  鱼传尺愫
    2021-02-06 08:34

    Writing the tests first and implementing after ensures that you are writing implementation code that is definitely going to pass the tests. Implementing first and writing the test code after runs the inherent risk that you will have to refactor (sometimes significantly) your implementation code to ensure correct testing coverage, which can become expensive depending on how late those tests are written.

    Personal experience, I've seen the best productivity/medium come from developers doing the tests concurrent to the implementation, doing enough up-front to ensure the boundaries of the interface contracts are correctly locked in and test-worthy, leaving tests that would not cause redesign/major refactoring toward the end, but not considering the component complete until a complete set of unit tests were delivered.

提交回复
热议问题