views:

984

answers:

3

I have written few c++ Unit tests using CPPUnit

But I do not understand how to run those.

Is there any tool like Nunit-gui?

Currently I have written and packed tests in a DLL.

When i google i found this http://cppunit.sourceforge.net/doc/lastest/cppunit_cookbook.html

But i am not able to understand how does it get tests from a DLL.

Thanks in advance

+2  A: 

Group your TestCases into TestSuite, write a main(), compile, link against the cppunit library and run the executable from the command-line.

Here is an example of a main function.:

CPPUNIT_TEST_SUITE_REGISTRATION(Test);

int main( int ac, char **av )
{
  //--- Create the event manager and test controller
  CPPUNIT_NS::TestResult controller;

  //--- Add a listener that colllects test result
  CPPUNIT_NS::TestResultCollector result;
  controller.addListener( &result );        

  //--- Add a listener that print dots as test run.
  CPPUNIT_NS::BriefTestProgressListener progress;
  controller.addListener( &progress );      

  //--- Add the top suite to the test runner
  CPPUNIT_NS::TestRunner runner;
  runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest() );
  runner.run( controller );

  return result.wasSuccessful() ? 0 : 1;
}

If you really want a GUI, there is QxRunner.

philippe
A: 

As mentioned in following link http://cvs.forge.objectweb.org/cgi-bin/viewcvs.cgi/checkout/sync4j/tools/cppunit/INSTALL-WIN32.txt?rev=1.1.1.1

TestPlugInRunner can be used

Uday
A: 

Hi, I'm looking for integrating CPPUnit in XStudio (a free test management software) so what I'm looking for now is a way to run (i.e. in command line) 1 particular CPPUnit test without having to compile anything. (Like what we do with the JUnitCore class). So basically a "consoleTestRunner" binary. Any idea if something like this exists by default on the CPPUnit distribution package? Eg\*

egavaldo