如何使用CppUnit做单元测试[2]

发表于:2008-07-03来源:作者:点击数: 标签:单元cppunitCppUnit
关键字: 测试 testrunnerd.lib : MFC TestRunner import library "Debug Multithreaded DLL" testrunneru.dll : MFC Unicode TestRunner dynamic library (DLL) "Multithreaded DLL" testrunneru.lib : MFC Unicode TestRunner import library "Multithreade
关键字:测试testrunnerd.lib   : MFC TestRunner import library "Debug Multithreaded DLL"

    testrunneru.dll   : MFC Unicode TestRunner dynamic library (DLL) "Multithreaded DLL"

    testrunneru.lib   : MFC Unicode TestRunner import library "Multithreaded DLL"

    testrunnerud.dll  : MFC Unicode TestRunner dynamic library (DLL) "Debug Multithreaded DLL"

    testrunnerud.lib  : MFC Unicode TestRunner import library "Debug Multithreaded DLL"

    TestRunnerDSPlugIn.dll : The add-in you register in VC++.


    A. 新建一个MFC应用程序

    B. 在“工具”-选项-目录

    C. 在工程配置里面选择RTTI

    Link下加入 Debug\cppunitd.lib Debug\testrunnerd.lib ,记得把这辆个文件从cppunit-1.10.2\lib拷出来,把相应的dll文件也拷到debug目录下

    D. 在App初始化函数中App::InitInstance()的开头加入

    #include <cppunit/ui/mfc/TestRunner.h>

    #include <cppunit/extensions/TestFactoryRegistry.h>

    在其中加入  

    CppUnit::MfcUi::TestRunner runner;

    runner.addTest( CppUnit::TestFactoryRegistry::getRegistry().makeTest() );

    runner.run();   

原文转自:http://www.ltesting.net