Using CppUnit

本文介绍了如何使用CppUnit库来进行C++单元测试。主要内容包括:在VS2005中默认启用RTTI设置;从SourceForge下载CppUnit源代码并编译;成功编译后仅需使用lib和include两个文件夹;在测试类中添加必要的注册代码;以及在应用程序类中实例成员函数中添加测试运行代码。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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();

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值