failure on makeTest

Help
2008-11-05
2013-04-22
  • Daanen Vincent
    Daanen Vincent
    2008-11-05

    Hi,

    i'm running into a strange trouble using TestFixture !

    First, let me give you the "source" files

    My TestClass is something like that (in A.h)
    class A : public CppUnit::TestFixture
    {
    public :
        A();
        ~A();

        void setUp();
        void tearDown();

        void Test1();
        void Test2();

        CPPUNIT_TEST_SUITE( A );
          CPPUNIT_TEST( Test1 );
          CPPUNIT_TEST( Test2 );

        CPPUNIT_TEST_SUITE_END();
    };

    ---
    A.cpp file is
     
    #include "A.h"
    CPPUNIT_TEST_SUITE_REGISTRATION( A )

    /*  Methods of class A are implemented here  */

    and finally the main.cpp file is

    #include <cppunit/extensions/TestFactoryRegistry.h>
    #include <cppunit/ui/text/TestRunner.h>
    #include "PatientManagerTest.h"

    int main(int argc, char **argv)
    {
        CppUnit::TextUi::TestRunner runner;
        runner.addTest( CppUnit::TestFactoryRegistry::getRegistry().makeTest() );
        runner.run();
    }  

    So the problem is that the test program fails on the line
      runner.addTest( CppUnit::TestFactoryRegistry::getRegistry().makeTest() );
     
    I'm using msvc 6.0. This is what the debbuger tells me (read from bottom to top)

    CppUnit::TestSuiteBuilderContextBase::~TestSuiteBuilderContextBase() line 22 + 11 bytes
    CppUnit::TestSuiteBuilderContext<CPatientManagerTest>::~TestSuiteBuilderContext<CPatientManagerTest>() + 37 bytes
    A::addTestsToSuite(CppUnit::TestSuiteBuilderContextBase & {...}) line 69 + 15 bytes
    A::suite() line 69 + 243 bytes
    CppUnit::TestSuiteFactory<A>::makeTest() line 21
    CppUnit::TestFactoryRegistry::addTestToSuite(CppUnit::TestSuite * 0x00332a50) line 149 + 13 bytes
    CppUnit::TestFactoryRegistry::makeTest() line 137
    main(int 1, char * * 0x003e33b0, char * * 0x003e3488) line 43 + 58 bytes

    I do not know what is missing ...
    could someone point me to the right direction please ...

    Thanks

      V

     
    • Sumanth Gowda
      Sumanth Gowda
      2008-11-06

      hi,

      In your message you have written , you have created files A.h and A.cpp
      But in main.cpp I see

      #include "PatientManagerTest.h"  included and not a.h

      Can you check that or provide more info.

      Sumanth

       
    • Daanen Vincent
      Daanen Vincent
      2008-11-06

      Hi,

      yes, that' s just a typo error. I replaced the class "CPatientManagerTest"  by the class A for sake of clarity ... I missed!
      So just change #include "PatientManagerTest.h" by #include "A.h" in main.cpp.

      I investigate today and it seems that this problem is linked by a way or by another one to use the of MSVC en cppunitd_dll.lib on a Win32 platform....

      Thanks for any help

      V