deb-subunit/c++
Robert Collins 493a10dc91 Move the C++ Listener from a patch against cppunit to a usable external module for cppunit. 2009-10-03 23:33:53 +10:00
..
README Move the C++ Listener from a patch against cppunit to a usable external module for cppunit. 2009-10-03 23:33:53 +10:00
SubunitTestProgressListener.cpp Move the C++ Listener from a patch against cppunit to a usable external module for cppunit. 2009-10-03 23:33:53 +10:00
SubunitTestProgressListener.h Move the C++ Listener from a patch against cppunit to a usable external module for cppunit. 2009-10-03 23:33:53 +10:00

README

#
#  subunit C++ bindings.
#  Copyright (C) 2006  Robert Collins <robertc@robertcollins.net>
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#

Currently there are no native C++ bindings for subunit. However the C library
can be used from C++ safely. A CPPUnit listener is built as part of Subunit to
allow CPPUnit users to simply get Subunit output.

To use the listener, use pkg-config (or your preferred replacement) to get the
cflags and link settings from libcppunit_subunit.pc.

In your test driver main, use SubunitTestProgressListener, as shown in this
example main::

  {
    // Create the event manager and test controller
    CPPUNIT_NS::TestResult controller;
  
    // Add a listener that collects test result
    // so we can get the overall status.
    // note this isn't needed for subunit...
    CPPUNIT_NS::TestResultCollector result;
    controller.addListener( &result );
  
    // Add a listener that print test activity in subunit format.
    CPPUNIT_NS::SubunitTestProgressListener 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;
  }