recently read the second chapter of the building method of personal skills and processes, teachers often remind us of the importance of unit testing in class , after reading the construction of the law of the book also recognized the importance of unit testing, a project must be a few people to the division of labor, then the different work is dependent on each other, in order to ensure the quality of the module, then unit testing is a very effective solution.
There are a few homework our teacher asked us to develop a small program to write unit tests, many people's unit test unqualified, or invalid test, a good unit test, should be able to accurately and quickly ensure the correctness of the basic module, the future development of the project must learn the correct unit testing, The standard for good unit testing:
A, unit test should be in the most basic functions, parameters to verify the correctness of the program.
B, unit testing must be written by the person most familiar with the code, in order to more comprehensive testing.
C, after the unit test, the machine state remains unchanged.
D, unit tests should produce repeatable, consistent results.
E, unit tests should overwrite all code paths.
F, unit tests should be integrated into the framework of automated tests.
G, unit tests must be saved and maintained together with the product code.
The method of construction read Note 02