Basic process of unit testing

xiaoxiao2021-03-06  116

XP promotes a rule called Test-First Design. With the Test First Design method, you write a unit test before writing a new feature, and use it to test the code that implements new features but maybe error. This means that the test is first fail, the purpose of writing code is to make these tests can be successfully run. The basic process of unit testing: 1. Design a test that should fail. The compiler should immediately reflect the failure. Because classes and methods that need to be used in the test have not been implemented. 2. If there is a compilation error, complete the code, as long as the compilation is passed, the code only reflects the intent of the code and is not implemented. 3. In JUnit, it should indicate the test failure 4. Write the actual code to make the test can succeed. 5. Run all the tests in JUnit to ensure that all tests are passed, once all tests pass, stop encoding. 6. Consider whether there is any other situation, no considering, write test, run it, modify the code when necessary, until the test passes

转载请注明原文地址:https://www.9cbs.com/read-102174.html

New Post(0)