| With the rapid development of computer technology, computer software is applied in every aspect of national economy and social life increasingly. Quality of software has become the focus to which is paid attention by those people who use or develop software. As the software is man-made, it is unavoidable that errors exist in software. Testing is the important way to ensure software quality. The purpose of software test is to find errors in the programs as early and more as possible so as to improve the quality of software. Unit test is to test the least units of software and to find if these least units are right. Unit test is the foundation of other level test, thus it must be tested after code are finished. The article puts forward a scheme of unit test system for C++ program and realizes it.Firstly, this article studies present situation and development tendency and introduces the basic theories of software test. Secondly, the article puts forward four steps to realize the unit test system. From them, the article designs a scheme to realize the unit test system for C++ program and establishes the system model. Thirdly, the article realizes unit test system by analyzing a C++ program in static and dynamic respects. Lastly, the article reports the unit test results.In static respect, the article realizes the test process from lexical and syntax analysis through C++ lexical and syntax rules. In static test respect, in consideration that the key of dynamic test is to design test cases, the article uses multiple different methods to construct test cases in order to produce better effect from fewer test cases. For example, equal-dividing method both assures complete test and reduces redundant test cases. Boundary-analyzing method is used to find boundary errors. Perpendicular experiment method is used to optimize test cases. The method of basic path test is used to ensure every basic path has been tested in order to reach sentence and path cover standard. Furthermore the article analyses emphatically object-oriented automatic test frame which is called Cppunit whose compilation regulation and realization mechanism, making use of this frame to run program and gaining unit test report. At last, the article carries on test for C++ program which is called Getting Next Date. The whole process and experiment result proves that unit test system is feasible and effective. |