Menu

Using TestPlugInRunner

Help
2003-07-28
2003-07-28
  • Wolfgang Berger

    Wolfgang Berger - 2003-07-28

    Could somebody explain me how to use the TestPlugInRunner in VC6.0 and CppUnit 1.9.11?

    I created a new dll-Project and added the files from the Money example (Money.* and MoneyTest.*). In InitInstance of the App-Object I call my RunUnitTests Function, which does the following:

    void CMyTestApp::RunUnitTests()
    {
        CPPUNIT_NS::MfcUi::TestRunner    runner;
        runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest() );

        runner.run();
    }

    Here are my includes in the same file:

    #include <cppunit/extensions/TestFactoryRegistry.h>
    #include <cppunit/ui/mfc/TestRunner.h>
    #include <cppunit/plugin/TestPlugIn.h>

    and the macro-call

    CPPUNIT_PLUGIN_IMPLEMENT();

    In the linker-options of VC the libs cppunit(d)_dll.lib are added.

    When compiling/linking, I get the following errors (I translated them from German so I don't know, if they are the same in the English version):

    mfcs42d.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in MyTest.obj
    mfcs42d.lib(dllmodul.obj) : warning LNK4006: _DllMain@12 already defined in MyTest.obj, second definition will be ignored

    MyTest.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall CppUnit::MfcTestRunner::~MfcTestRunner(void)" (__imp_??1MfcTestRunner@CppUnit@@UAE@XZ)

    MyTest.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall CppUnit::MfcTestRunner::run(void)" (__imp_?run@MfcTestRunner@CppUnit@@QAEXXZ)

    MyTest.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall CppUnit::MfcTestRunner::addTest(class CppUnit::Test *)" (__imp_?addTest@MfcTestRunner@CppUnit@@QAEXPAVTest@2@@Z)

    MyTest.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall CppUnit::MfcTestRunner::MfcTestRunner(void)" (__imp_??0MfcTestRunner@CppUnit@@QAE@XZ)

    The first messages (the error/warning combination) appear when the macro-call CPPUNIT_PLUGIN_IMPLEMENT(); is made.

    The others come from the Mfc-Testrunner object. Has anybody had the same problems and maybe a solution to this?

    Thanks in advance.

     
    • Wolfgang Berger

      Wolfgang Berger - 2003-07-28

      OK, forget the last four messages (it was my fault - at least I think that a testrunner isn't necessary here)

      but the first two still occur

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.