Menu

newbie question

Help
2002-09-12
2002-11-20
  • Honza Fedak

    Honza Fedak - 2002-09-12

    hi,

    I am sorry for the primitive question but I want to ask how to set up a very primitive test suite. I am able to make a test suite based on HostApp but I can't believe this is the easiest way.

    I would expect that I am able to create a test suite let's say as a DLL that I just load into some external program and it will run the tests for me.

    I really don't want to have all of the code of HostApp with every test suite that I write.

    Any comment is welcome. Thank you, Jan

     
    • Wolfgang Stoecher

      In Visual Studio I just declare a dialog based MFC-application. Then I remove the resources, dialogs, stdafx and related stuff and boil the main cpp-file down to (see below). Thus I'm left with only one file from the wizard generated framework . Then ofcourse you also need these libs for linking:
      cppunit(d).lib testrunner(d).lib

      hope this helps,
      Wolfgang

      #include "afxwin.h"
      #include <msvc6/testrunner/TestRunner.h>
      #include <cppunit/extensions/TestFactoryRegistry.h>

      class CUnitsApp : public CWinApp
      {
      public:
         CUnitsApp() {}

          //{{AFX_VIRTUAL(CUnitsApp)
          virtual BOOL InitInstance();
          //}}AFX_VIRTUAL
      };

      CUnitsApp theApp;

      static void RunTestRunner()
      {
        TestRunner runner;
        runner.addTest( CppUnit::TestFactoryRegistry::getRegistry().makeTest() );
        runner.run();
      }

      BOOL CUnitsApp::InitInstance()
      {
         RunTestRunner();
         return FALSE;
      }

       
    • Anonymous

      Anonymous - 2002-11-20

      thaks for your example. it works.
      but i detect some memory leaks on it.

      is there anyone who solves this problem? :)

       

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.