The arcticle of codeproject is very clear about using CppUnit.
http://www.codeproject.com/library/Using_CPPUnit.asp
But I will speak about some important issues about the upon article:
1)If we use vs2005,RTTI setting is enalbed defaultly.We needn't to do it.
2)We can down load the source code from http://sourceforge.net/projects/cppunit
3)Compile the project in folder cppunit-1.10.2/src
4)When we compile the project successfully,we are only need of two folders named as"lib" and "include"
5)For our testing class,we need to add this line into .cpp file:
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(TestOpen,"freebird");
6)As well as,we need to add some codes into Instance member function of our application class
CppUnit::MfcUi::TestRunner runner;
runner.addTest(CppUnit::TestFactoryRegistry::getRegistry("freebird").makeTest());
runner.run();
本文介绍了如何使用CppUnit库来进行C++单元测试。主要内容包括:在VS2005中默认启用RTTI设置;从SourceForge下载CppUnit源代码并编译;成功编译后仅需使用lib和include两个文件夹;在测试类中添加必要的注册代码;以及在应用程序类中实例成员函数中添加测试运行代码。
359

被折叠的 条评论
为什么被折叠?



