Testing a .DLL

Help
Jordan Day
2009-02-05
2013-04-22
  • Jordan Day

    Jordan Day - 2009-02-05

    Hi, I'm newbie to CppUnit and I'm running into some trouble using CppUnit with a .DLL (I'm using MSVC 6).

    I've created just a basic dll project in VC and added a simple test class, basically in the same vein as the instructions here: https://www.embracetherandom.com/MFCTestRunner/index.htm

    I'm linking against cppunit_dll.lib and testrunner.lib.

    When I run TestPlugInRunner.exe and select my dll from "Choose DLL" an error dialog pops up reporting "Symbol [cppunitTestPlugIn] not found in dynamic library..."

    Here's the code from my test class:
    TestClass.h
    // TestClass.h: interface for the CTestClass class.
    //
    //////////////////////////////////////////////////////////////////////

    #if !defined(AFX_TESTCLASS_H__66A29ADF_B786_4AAF_B567_DBE76FE271E8__INCLUDED_)
    #define AFX_TESTCLASS_H__66A29ADF_B786_4AAF_B567_DBE76FE271E8__INCLUDED_

    #if _MSC_VER > 1000
    #pragma once
    #endif // _MSC_VER > 1000

    #include <cppunit/extensions/HelperMacros.h>

    class CTestClass : public CppUnit::TestFixture
    {
        CPPUNIT_TEST_SUITE( CTestClass );
            CPPUNIT_TEST( Test1 );
        CPPUNIT_TEST_SUITE_END();
    public:
        void setUp();
        void tearDown();

    protected:
        void Test1();

    };

    #endif // !defined(AFX_TESTCLASS_H__66A29ADF_B786_4AAF_B567_DBE76FE271E8__INCLUDED_)

    TestClass.cpp
    // TestClass.cpp: implementation of the CTestClass class.
    //
    //////////////////////////////////////////////////////////////////////

    #include "stdafx.h"
    #include "testdll.h"
    #include "TestClass.h"

    #ifdef _DEBUG
    #undef THIS_FILE
    static char THIS_FILE[]=__FILE__;
    #define new DEBUG_NEW
    #endif

    #include <cppunit/extensions/HelperMacros.h>

    //////////////////////////////////////////////////////////////////////
    // Construction/Destruction
    //////////////////////////////////////////////////////////////////////

    void CTestClass::setUp()
    {
    }

    void CTestClass::tearDown()
    {
    }

    void CTestClass::Test1()
    {
        CPPUNIT_ASSERT_ASSERTION_FAIL("Test Not Implemented");
    }

    I'd really appreciate any feedback anyone could give me, I've been looking at this for awhile now and I know I must just be missing something simple.

    Thanks.

     
    • Jordan Day

      Jordan Day - 2009-02-05

      I guess I should add that I am wanting to test in a .DLL that already has a DllMain. According to this post http://sourceforge.net/forum/forum.php?thread_id=1075752&forum_id=37108, and some others, I shouldn't have to use the CPPUNIT_PLUGIN_IMPLEMENT macro, but I'm not sure what I'm missing that is keeping it from working.

       

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks