测试用例应该在创建项目之前还是之后编写?
Should test cases written before or after creating the project?
什么时候必须按逻辑编写 JUnit 测试用例?创建应用程序之前还是之后?对于大型应用程序应该如何编写?基于我们创建的代码或基于需求规范。
理想情况下,应该先编写单元测试用例,然后再编写代码。许多人遵循测试驱动开发 (TDD)。但同样是它的选择,作为最佳实践的一部分,我更喜欢 TDD。
TDD (Test Driven Development) is a computer programming method that
consists of small iterations. In this method you begin by writing the
test cases covering the new functionality, then you write the
production code necessary to make the test pass, and after that you
refactor the code to make it more maintainable. Writing the tests
before writing the code guaranties immediate feedback after changes
are made. TDD (test-driven development) is a technique for designing
the software as well as testing it.
In Test Driven Development (TDD) automated unit tests are written
before the code is actually written. Running these tests give you fast
confirmation of whether your code behaves as it should
。
什么时候必须按逻辑编写 JUnit 测试用例?创建应用程序之前还是之后?对于大型应用程序应该如何编写?基于我们创建的代码或基于需求规范。
理想情况下,应该先编写单元测试用例,然后再编写代码。许多人遵循测试驱动开发 (TDD)。但同样是它的选择,作为最佳实践的一部分,我更喜欢 TDD。
TDD (Test Driven Development) is a computer programming method that consists of small iterations. In this method you begin by writing the test cases covering the new functionality, then you write the production code necessary to make the test pass, and after that you refactor the code to make it more maintainable. Writing the tests before writing the code guaranties immediate feedback after changes are made. TDD (test-driven development) is a technique for designing the software as well as testing it.
In Test Driven Development (TDD) automated unit tests are written before the code is actually written. Running these tests give you fast confirmation of whether your code behaves as it should
。