CppUnit with Visual Studio .NET?

Anonymous
2002-01-31
2013-04-22
  • Anonymous - 2002-01-31

    Anyone managed to build or use CppUnit with Visual Studio .NET?

    I tried following the Visual C++ 6 instructions but didn't get very far ...

     
    • Anonymous - 2002-02-01

      I found the following item:

      http://www.iunknown.com/Articles/fog0000000025.html

      which helped me to get started ...

       
      • john_1726

        john_1726 - 2007-05-09

        John,

        Do you happen to be aware of a similar article to the one you posted?

        > http://www.iunknown.com/Articles/fog0000000025.html

        Doesn't exist anymore.

        TIA.

         
      • john_1726

        john_1726 - 2007-05-09

        Nevermind.  I was receiving a bunch of errors (see below) after trying to compile all the examples, so I just renamed
        testrunnerud.lib to testrunnerd.lib, testrunnerud.dll to testrunnerd.dll and cppunitd_dll.dll to cppunit_dll.dll, and then Visual Studio .NET 2005 compiled everything fine.

        ------ Build started: Project: cppunit, Configuration: Debug Win32 ------
        Compiling...
        TestResultCollector.cpp
        TestSuccessListener.cpp
        TextTestProgressListener.cpp
        TextTestResult.cpp
        TextTestRunner.cpp
        CompilerOutputter.cpp
        TextOutputter.cpp
        XmlOutputter.cpp
        XmlOutputterHook.cpp
        AdditionalMessage.cpp
        Asserter.cpp
        Exception.cpp
        Message.cpp
        SourceLine.cpp
        SynchronizedObject.cpp
        Test.cpp
        TestAssert.cpp
        TestCase.cpp
        TestComposite.cpp
        TestFailure.cpp
        Generating Code...
        Compiling...
        TestLeaf.cpp
        TestPath.cpp
        TestResult.cpp
        TestRunner.cpp
        TestSuite.cpp
        TestFactoryRegistry.cpp
        TestNamer.cpp
        TestSuiteBuilderContext.cpp
        TypeInfoHelper.cpp
        RepeatedTest.cpp
        TestCaseDecorator.cpp
        TestDecorator.cpp
        TestSetUp.cpp
        BeOsDynamicLibraryManager.cpp
        DynamicLibraryManager.cpp
        DynamicLibraryManagerException.cpp
        PlugInManager.cpp
        PlugInParameters.cpp
        ShlDynamicLibraryManager.cpp
        TestPlugInDefaultImpl.cpp
        Generating Code...
        Compiling...
        UnixDynamicLibraryManager.cpp
        Win32DynamicLibraryManager.cpp
        StringTools.cpp
        XmlDocument.cpp
        XmlElement.cpp
        DefaultProtector.cpp
        Protector.cpp
        ProtectorChain.cpp
        BriefTestProgressListener.cpp
        Generating Code...
        Creating library...
        Copying target to lib/
                1 file(s) copied.
        Build log was saved at "file://c:\cygwin\usr\src\cppunit-1.12.0\src\cppunit\Debug\BuildLog.htm"
        cppunit - 0 error(s), 0 warning(s)
        ------ Build started: Project: DllPlugInTester, Configuration: Debug Unicode Win32 ------
        Compiling...
        DllPlugInTester.cpp
        Linking...
        Embedding manifest...
        Copying target to lib/
                1 file(s) copied.
        Build log was saved at "file://c:\cygwin\usr\src\cppunit-1.12.0\src\DllPlugInTester\DebugUnicode\BuildLog.htm"
        DllPlugInTester - 0 error(s), 0 warning(s)
        ------ Build started: Project: TestRunner, Configuration: Debug Unicode Win32 ------
        Linking...
        .\TestRunner.def(4) : warning LNK4017: DESCRIPTION statement not supported for the target platform; ignored
           Creating library .\DebugUnicode/testrunnerud.lib and object .\DebugUnicode/testrunnerud.exp
        Embedding manifest...
        Copying target to lib/
                1 file(s) copied.
                1 file(s) copied.
        Build log was saved at "file://c:\cygwin\usr\src\cppunit-1.12.0\src\msvc6\testrunner\DebugUnicode\BuildLog.htm"
        TestRunner - 0 error(s), 1 warning(s)
        ------ Build started: Project: money, Configuration: Debug Win32 ------
        Compiling...
        StdAfx.cpp
        Compiling...
        MoneyApp.cpp
        MoneyTest.cpp
        Generating Code...
        Linking...
        Embedding manifest...
        Unit testing...
        ....
        OK (4)
        Build log was saved at "file://c:\cygwin\usr\src\cppunit-1.12.0\examples\money\Debug\BuildLog.htm"
        money - 0 error(s), 0 warning(s)
        ------ Build started: Project: simple, Configuration: Debug Win32 ------
        Compiling...
        ExampleTestCase.cpp
        Main.cpp
        Generating Code...
        Compiling manifest to resources...
        Linking...
        Embedding manifest...
        Build log was saved at "file://c:\cygwin\usr\src\cppunit-1.12.0\examples\simple\Debug\BuildLog.htm"
        simple - 0 error(s), 0 warning(s)
        ------ Build started: Project: TestPlugInRunner, Configuration: Debug Win32 ------
        Updating c:\cygwin\usr\src\cppunit-1.12.0\lib\cppunitd_dll.dll
                1 file(s) copied.
        Compiling...
        StdAfx.cpp
        WINVER not defined. Defaulting to 0x0502 (Windows Server 2003)
        Compiling...
        TestRunnerDSPluginVC6_i.c
        Compiling...
        TestPlugInRunnerApp.cpp
        TestPlugInRunnerDlg.cpp
        TestPlugIn.cpp
        TestPlugInException.cpp
        TestPlugInRunnerModel.cpp
        ListCtrlFormatter.cpp
        ListCtrlSetter.cpp
        MsDevCallerListCtrl.cpp
        ProgressBar.cpp
        ResourceLoaders.cpp
        TestRunnerDlg.cpp
        TreeHierarchyDlg.cpp
        cdxCDynamicDialog.cpp
        cdxCDynamicWnd.cpp
        cdxCDynamicWndEx.cpp
        cdxCSizeIconCtrl.cpp
        *** NOTE[cdxCSizeIconCtrl.cpp]: Please define OEMRESOURCE in your project settings !
        ActiveTest.cpp
        TestRunnerModel.cpp
        MostRecentTests.cpp
        Generating Code...
        Compiling resources...
        Linking...
        Embedding manifest...
        Copying target to lib/
                1 file(s) copied.
        Build log was saved at "file://c:\cygwin\usr\src\cppunit-1.12.0\src\msvc6\testpluginrunner\Debug\BuildLog.htm"
        TestPlugInRunner - 0 error(s), 0 warning(s)
        ------ Build started: Project: HostApp, Configuration: Debug No Type Info Name Win32 ------
        Compiling...
        StdAfx.cpp
        WINVER not defined. Defaulting to 0x0502 (Windows Server 2003)
        Compiling...
        HostApp.cpp
        HostAppDoc.cpp
        HostAppView.cpp
        MainFrm.cpp
        Generating Code...
        Linking...
        LINK : fatal error LNK1181: cannot open input file '..\..\..\lib\testrunnerd.lib'
        Build log was saved at "file://c:\cygwin\usr\src\cppunit-1.12.0\examples\msvc6\HostApp\DebugNoTypeInfoName\BuildLog.htm"
        HostApp - 1 error(s), 0 warning(s)
        ------ Build started: Project: DumperPlugIn, Configuration: Debug Win32 ------
        Compiling...
        DumperListener.cpp
        DumperPlugIn.cpp
        Generating Code...
        Linking...
           Creating library .\Debug/DumperPlugInd.lib and object .\Debug/DumperPlugInd.exp
        Embedding manifest...
        Build log was saved at "file://c:\cygwin\usr\src\cppunit-1.12.0\examples\DumperPlugIn\Debug\BuildLog.htm"
        DumperPlugIn - 0 error(s), 0 warning(s)
        ------ Build started: Project: DllPlugInTesterTest, Configuration: Debug Win32 ------
        Updating c:\cygwin\usr\src\cppunit-1.12.0\lib\cppunitd_dll.dll
                1 file(s) copied.
        Updating c:\cygwin\usr\src\cppunit-1.12.0\lib\cppunit_dll.dll
        The system cannot find the file specified.
        Project : error PRJ0019: A tool returned an error code from "Updating c:\cygwin\usr\src\cppunit-1.12.0\lib\cppunit_dll.dll"
        Build log was saved at "file://c:\cygwin\usr\src\cppunit-1.12.0\src\DllPlugInTester\DebugTest\BuildLog.htm"
        DllPlugInTesterTest - 1 error(s), 0 warning(s)
        ------ Build started: Project: simple_plugin, Configuration: Debug Win32 ------
        Compiling...
        SimplePlugIn.cpp
        Linking...
           Creating library .\DebugPlugIn/simple_plugind.lib and object .\DebugPlugIn/simple_plugind.exp
        Embedding manifest...
        Running tests...
        '..\..\lib\DllPlugInTesterd_dll.exe' is not recognized as an internal or external command,
        operable program or batch file.
        Project : error PRJ0019: A tool returned an error code from "Running tests..."
        Build log was saved at "file://c:\cygwin\usr\src\cppunit-1.12.0\examples\simple\DebugPlugIn\BuildLog.htm"
        simple_plugin - 1 error(s), 0 warning(s)
        ------ Build started: Project: hierarchy, Configuration: Debug Win32 ------
        Compiling...
        BoardGame.cpp
        Chess.cpp
        main.cpp
        Generating Code...
        Linking...
        Embedding manifest...
        Build log was saved at "file://c:\cygwin\usr\src\cppunit-1.12.0\examples\hierarchy\Debug\BuildLog.htm"
        hierarchy - 0 error(s), 0 warning(s)
        ------ Build started: Project: CppUnitTestPlugIn, Configuration: Debug Win32 ------
        Compiling...
        CppUnitTestPlugIn.cpp
        Linking...
           Creating library .\DebugPlugIn/CppUnitTestPlugInd.lib and object .\DebugPlugIn/CppUnitTestPlugInd.exp
        Embedding manifest...
        Build log was saved at "file://c:\cygwin\usr\src\cppunit-1.12.0\examples\cppunittest\DebugPlugIn\BuildLog.htm"
        CppUnitTestPlugIn - 0 error(s), 0 warning(s)
        ------ Build started: Project: CppUnitTestMain, Configuration: Debug DLL Win32 ------
        Updating DLL: c:\cygwin\usr\src\cppunit-1.12.0\lib\cppunitd_dll.dll
                1 file(s) copied.
        Linking...
        Embedding manifest...
        Self test
        Running ...........................................................................................................................................................................................................................
        OK (219)
        Build log was saved at "file://c:\cygwin\usr\src\cppunit-1.12.0\examples\cppunittest\DebugDLL\BuildLog.htm"
        CppUnitTestMain - 0 error(s), 0 warning(s)
        ------ Build started: Project: CppUnitTestApp, Configuration: Debug Win32 ------
        .\Debug\testrunnerd.dll
        The system cannot find the file specified.
        Project : error PRJ0019: A tool returned an error code from ".\Debug\testrunnerd.dll"
        Build log was saved at "file://c:\cygwin\usr\src\cppunit-1.12.0\examples\msvc6\CppUnitTestApp\Debug\BuildLog.htm"
        CppUnitTestApp - 1 error(s), 0 warning(s)
        ------ Build started: Project: ClockerPlugIn, Configuration: Debug NtTimer Win32 ------
        Compiling...
        WinNtTimer.cpp
        Compiling...
        ClockerListener.cpp
        ClockerModel.cpp
        ClockerPlugIn.cpp
        ClockerXmlHook.cpp
        Generating Code...
        Linking...
           Creating library .\DebugNtTimer/ClockerPlugInNtd.lib and object .\DebugNtTimer/ClockerPlugInNtd.exp
        Embedding manifest...
        Build log was saved at "file://c:\cygwin\usr\src\cppunit-1.12.0\examples\ClockerPlugIn\DebugNtTimer\BuildLog.htm"
        ClockerPlugIn - 0 error(s), 0 warning(s)
        ========== Build: 11 succeeded, 4 failed, 1 up-to-date, 0 skipped ==========

         
        • john_1726

          john_1726 - 2007-05-14

          The above compilation which worked was from loading the examples.dsw file.  When I opened the CppUnitLibraries.dsw, with the output of compilation being given below.  Does anyone have any ideas as to why I am receiving "error C1104: fatal error importing libid"?

          ------ Build started: Project: TestRunner, Configuration: Debug Unicode Win32 ------
          Compiling...
          MsDevCallerListCtrl.cpp
          .\MsDevCallerListCtrl.cpp(67) : error C3505: cannot load type library '{80CC9F66-E7D8-4DDD-85B6-D9E6CD0E93E2}'
          .\MsDevCallerListCtrl.cpp(67) : fatal error C1104: fatal error importing libid: '80cc9f66-e7d8-4ddd-85b6-d9e6cd0e93e2'
          Creating browse information file...
          Microsoft Browse Information Maintenance Utility Version 8.00.50727
          Copyright (C) Microsoft Corporation. All rights reserved.
          BSCMAKE: error BK1506 : cannot open file '.\DebugUnicode\MsDevCallerListCtrl.sbr': No such file or directory
          Build log was saved at "file://c:\cygwin\usr\src\cppunit-1.12.0\src\msvc6\testrunner\DebugUnicode\BuildLog.htm"
          TestRunner - 3 error(s), 0 warning(s)
          ------ Build started: Project: TestPlugInRunner, Configuration: Debug Win32 ------
          Compiling...
          TestPlugInRunnerApp.cpp
          TestPlugInRunnerDlg.cpp
          TestPlugIn.cpp
          TestPlugInException.cpp
          TestPlugInRunnerModel.cpp
          ListCtrlFormatter.cpp
          ListCtrlSetter.cpp
          MsDevCallerListCtrl.cpp
          ..\testrunner\MsDevCallerListCtrl.cpp(67) : error C3505: cannot load type library '{80CC9F66-E7D8-4DDD-85B6-D9E6CD0E93E2}'
          ..\testrunner\MsDevCallerListCtrl.cpp(67) : fatal error C1104: fatal error importing libid: '80cc9f66-e7d8-4ddd-85b6-d9e6cd0e93e2'
          ProgressBar.cpp
          ResourceLoaders.cpp
          TestRunnerDlg.cpp
          TreeHierarchyDlg.cpp
          cdxCDynamicDialog.cpp
          cdxCDynamicWnd.cpp
          cdxCDynamicWndEx.cpp
          cdxCSizeIconCtrl.cpp
          *** NOTE[cdxCSizeIconCtrl.cpp]: Please define OEMRESOURCE in your project settings !
          ActiveTest.cpp
          TestRunnerModel.cpp
          MostRecentTests.cpp
          Generating Code...
          Build log was saved at "file://c:\cygwin\usr\src\cppunit-1.12.0\src\msvc6\testpluginrunner\Debug\BuildLog.htm"
          TestPlugInRunner - 2 error(s), 0 warning(s)
          ------ Build started: Project: DllPlugInTester, Configuration: Debug Static Win32 ------
          Linking...
          Embedding manifest...
          Copying target to lib/
                  1 file(s) copied.
          Build log was saved at "file://c:\cygwin\usr\src\cppunit-1.12.0\src\DllPlugInTester\Debug\BuildLog.htm"
          DllPlugInTester - 0 error(s), 0 warning(s)
          ========== Build: 1 succeeded, 2 failed, 3 up-to-date, 0 skipped ==========

           
    • Philippe Lavoie

      Philippe Lavoie - 2002-03-04

      My biggest problem with cppunit under .NET was that I had to remove the dependencies on DSPlugIn.

      I'll have to dig somewhere to find out how to create an add-in for Visual .NET that will allow me to link to the line number.

      The other problem is that I can't create a shared library of my test cases. On the forums, someone mentionnned that he modified cppunit to do so. Hopefully, I'll send this as a patch so we can all use it :)

       
    • Lynn Allan

      Lynn Allan - 2002-04-20

      CppUnit assistance

      I also came across a webpage by John Lam that may be useful.  I believe it is specifically concerned with an earlier version of cppunit, but I found it useful to get cppunit to compile/link with visual c++.

      http://www.iunknown.com/Articles/fog0000000025.html

      I put together something similar that may be useful for ver 1.8.0.  There is a very simple, barebones vc6 full project that updates the "cookbook" example for vc6 that used a Complex class.  It has the settings all predone and can serve as a template.  It is assumed to be 'installed' at:
      <cppunit_home>\exmaples\msvc6\ComplexVc6Cookbook.

      The vc6 project (including .dsw, .dsp, .cpp, and .exe) is available directly from:
      http://prdownloads.sourceforge.net/inverse/ComplexVc6Cookbook.zip
      or:
      http://home.att.net/~bibleinverse/Misc/ComplexVc6Cookbook.zip

      There is also a somewhat fuller example using a simple Employee class. The included .dsw and .dsp already have the settings for resolving includes, libs, and dll's. It is assumed to be 'installed' at:
      <cppunit_home>\exmaples\msvc6\EmpVc6Cookbook.

      The vc6 project (.dsw, .dsp, .cpp, and .exe) is available directly from:
      http://prdownloads.sourceforge.net/inverse/EmpVc6Cookbook.zip
      or:
      http://home.att.net/~bibleinverse/Misc/EmpVc6Cookbook.zip

      There is yet another example with a less simple Employee class.  It was actually written to document a possible flaw in cppunit, but can also serve as a vc6 example.  Realize there is some flaky/confusing code in it that illustrate which 'handler' is called by the cppunit framework.

      This Employee class has std::strings for _firstname and _lastname.  Equality is considered having the first and last names being the same, without case sensitivity.  Therefore, a 'deep' compare is required for CPPUNIT_ASSERT_EQUAL rather than a shallow compare of whether the pointers are the same.

      This vc6 project (including .dsw, .dsp, .cpp, and .exe) has the settings for includes, multi-thread dll's, and .lib. It assumes that it is installed at:
      <cppunit_home>\examples\msvc6\Emp_Vc6

      It is available directly at:
      http://prdownloads.sourceforge.net/inverse/CppUnit_EmpVc6_5.zip
      or:
      http://home.att.net/~bibleinverse/Misc/CppUnit_EmpVc6_5.zip

      HTH,
      Lynn Allan

       

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

Sign up for the SourceForge newsletter:





No, thanks