= Frequently Asked Questions about CppUnit =

Feel free to add questions or answer ones that already exist

== Concepts ==

=== What are Plugins for ===
(answer needed)

== How do I? ==

=== How do I run a subset of tests ===
(answer needed)

=== How would I use CppUnit for automated testing ===
(answer needed)

=== How do I print debug info ===
like what test is it that makes an segmentation fault?
(answer needed)

=== How do I stop abort() being called when a test fails? ===
Compile your code with -fexceptions

=== How do I get the name of the test from within the setUp function? ===
Neither the setUp() nor tearDown() functions know the name of the test being called, so you can't customize these for different tests.  If you need to setup the environment for a single test, include that setup with the test.  If several tests share the environment, then consider private data and functions, with each test calling the shared setup function.  If all but a few need the same environment, then consider putting it in setUp() and tearDown(), and adding extra code to the non-cooperative tests.  

=== How can I create test hierarchy (suite of tests that contains other suites)? ===
Use the CPPUNIT_TEST_SUB_SUITE() macro.  For instance:
{{{#!cplusplus
 #include <cppunit/extensions/HelperMacros.h>

 class MyTest {
   CPPUNIT_TEST_SUITE( MyTest );
   CPPUNIT_TEST( testBasic );
   CPPUNIT_TEST_SUITE_END();
 public:
   void testBasic();
 };

 class MySubTest : public MyTest {
   CPPUNIT_TEST_SUB_SUITE( MySubTest, MyTest );
   CPPUNIT_TEST( testAdd );
   CPPUNIT_TEST( testSub );
   CPPUNIT_TEST_SUITE_END();
 public:
   void testAdd();
   void testSub();
 };
}}}
My``Test will run testBasic, while My``Sub``Test will run testAdd, testSub, and testBasic.  See the [http://cppunit.sourceforge.net/doc/lastest/group___writing_test_fixture.html Writing Test Fixture] section of the documentation.  If you are testing a class heirarchy with abstract classes, CPPUNIT_TEST_SUITE_END_ABSTRACT() may also be useful, to create a test fixture that exercises pure virtual functions.


=== Is there a program, like JUnitDoclet, that will generate test skeletons automatically? ===

----
