TDD

TDD 的理解开始 错了了

TDD(测试驱动开发)-Test-Driven Development。 先写测试用例在开发。

先用 junit 写测试,然后再写代码;
写完代码,运行测试,如果测试失败,修改代码,运行测试……直到测试成功。
如果以后对程序进行修改,重构 ( refactoring ),只要再运行测试代码。如果所有的测试都成功,则代码修改完成。

TDD life-cycle:

  1. Write the test
  2. Run the test (there is no implementation code, test does not pass)
  3. Write just enough implementation code to make the test pass
  4. Run all tests (tests pass)
  5. Refactor
  6. Repeat
  7. Test-driven development is not about testing. Test-driven development is about development (and design), specifically improving the quality and design of code. The resulting unit tests are just an extremely useful by-product.

 more please refer to this page :https://technologyconversations.com/2013/12/24/test-driven-development-tdd-best-practices-using-java-examples-2/

posted @ 2020-10-20 20:43  tzmok  阅读(179)  评论(0编辑  收藏  举报