CppUnit - C++ port of JUnit Code
Brought to you by:
blep
New in CppUnit 1.9.4:
----------------------
- More versatile, easier to make test plug-in.
- A PlugInManager to manage multiple test plug-ins.
- Crossplatform test plug-in runner.
- A brief progress listener
- Easier test hierarchy creation
- Improved documentation.
- Tracking of test run start/end.
- Added simple example
- Contribution: XML style sheet & borland 5.5 makefile.
* TestPlugIn:
- A simple fact I realised while testing: if you link your test plug-in
against the DLL version of cppunit (or shared library on Unix), then
test registered to the TestFactoryRegistry (it is what's hide behind
CPPUNIT_TEST_SUITE_REGISTRATION) are automatically shared. Changes
have been made to support that usage (CppUnit was crashing badly).
Using the TestFactoryRegistry provides much more flexiblity that
providing a single suite for the plug-in. As such:
- CppUnit plug-in should be linked against the dll version of CppUnit library.
- Plug-in should register their tests using the CPPUNIT_TEST_SUITE_xxx macros.
- 'homemade' suite can still be registred to the TestFactoryRegistry that is
passed as parameter on plug-in initialization. Notes that you must
unregister those suites during plug-in uninitialization, otherwise on
destruction, the TestFactoryRegistry will attempt to destroy them... Your
plug-in would have been already unloaded...
- Plug-in can accept parameters on initialization (notes that the Parameters
object is far from being stabilized, but whatever form it takes, it will be
a list of string).
- Plug-in can register their one listener for a test run. This means that you
can extends 'DllPlugInTester' by creating test plug-in... This also means
than you can listen to startTestRun()/endTestRun() to do some global
setUp/tearDown (to initialize globales resources, such as COM...)
* PlugInManager:
- The PlugInManager is used to load/unload plug-ins. It takes care of all
the 'plug-in' protocol and makes it easy to use multiple plug-ins at the
same time. It dispatches the addListener()/removeListener() message to
each plug-in.
* Crossplatform test plug-in runner (src/DllPlugInRunner):
- This application can be used to run your test plug-ins. It can load
multiple test plug-ins and run all or a specific test in the test
hierarchy returned by TestFactoryRegistry::getRegistry().makeTest().
- Plug-in loaded by the plug-in may also be custom TestListener.
- It can be use for post-build check and to debug the plug-in.
- Why use it? It keep you away from CppUnit API changes!
* Easier test hierarchy creation (TestFactoryRegistry/HelperMacros):
- added method addRegistry(name) to add a named registry to the registry.
see TestFactoryRegistry for an example of use.
- added macros CPPUNIT_REGISTRY_ADD( which, to ) and
CPPUNIT_REGISTRY_ADD_TO_DEFAULT( which ) to create test hierarchy at static
initialization (in the spirit of CPPUNIT_TEST_SUITE_xxx() macros).
* VerboseTestProgressListener:
- A new TestListener that prints the test name before running it. Most useful when
a test crashing, mean a application crash.
* Simple example (example/simple):
- Added crossplatform simple example. Equivalent to VC++ HostApp example.
* Documentation:
- More details about the test plug-in, how to use it, how does it works...
See module/Writing Test Plug-in.
* Contribution
- Contributed by project cuppa team (http://sourceforge.jp/projects/cuppa/):
- XML style sheet: transform CppUnit XML output into HTML.
- Makefile for CppUnit with Borland C++ 5.5 free compiler.
* Behavior changes:
- Test runner should call TestResult::runTest() to run the 'top level' test. This
will inform the TestListener of the test run start/end.
* Compatiblity break:
- TestFactoryRegistry don't own register test anymore. AutoRegisterSuite has
been updated to preverse its apparent behavior. It should be of concern
if you created and registered custom TestFactory.
* Compatiblity Break for 1.9.2 users:
- TestPlugIn.h: CppUnitTestPlugIn as been completly rewritten.
- TestPlugIn.h: macro CPPUNIT_PLUGIN_IMPLEMENT() don't take any arguments.
- TestSuitePlugIn: removed. A similar functionnality is provided by
PlugInManager.
- TestPlugInDefaultImpl: renamed TestPlugInAdapter. It does not implements
any default behavior anymore.
- DllPlugInRunner: no longer support multiple specific tests. The test path must
be prefixed with ':'. Release and Debug configuration links against cppunit_dll.
* Bug Fix:
- Crash when linking CppUnit DLL within another DLL that registered test. Caused
by the destruction of tests registered to TestFactoryRegistry. Fixed by
providing a register/unregister interface and removing the ownership of
TestFactory to TestFactoryRegistry.
New in CppUnit 1.9.2:
----------------------
In short:
- Cleaner XML output
- Crossplatform Test plug-in
- TestPlugInSuite to wrap test plug-in
- More TestPlugIn documentation.
* TestPlugIn:
- The test plug-in functionnality has been rewritten from scrash.
TestPlugIn related macro are now crossplatform (exporting the plug-in
function from the dynamic library...).
- Class DynamicLibraryManager provides a generic way to access dynamic
library. Platform specific implementation provided for WIN32, unix, BeOs.
Can be very easily ported to new platform.
- A More flexible and hopefully extensible interface has been introduced
(CppUnitPlugIn).
- A default implementation using the test factory registry is provided
(TestPlugInDefaultImpl). Can be easily customized.
- The one line test plug-in declaration was renamed CPPUNIT_PLUGIN_IMPLEMENT.
See modules/Writing Test Plug-in documentation and examples/EasyTestPlugIn.
* XmlOutputter:
- XML output is now indented. Nodes that don't have children are one line
tag. The output can now easily be read.
* Compatibility break:
- class TestSucessListener was renamed to TestSuccessListener.
- XmlOutput: renamed tag <SuccessfulTests> to <SuccessfulTests>
- Global fix of the 'success' typo (was misspelled 'sucess'). Main impacts are listed
above, but check your own code in case you override some protected/private methods.
- TestPlugInInterface (include/msvc6/TestPlugInInterface.h): this header and class
are now obsolete. You should use include/cppunit/plugin/TestPlugIn.h instead.
Macro CPPUNIT_TESTPLUGIN_IMPL have been replaced by CPPUNIT_PLUGIN_IMPLEMENT.
- TestDecorator inherits Test instead of TestLeaf.
- DllPlugInTester only run DLL implementing the new new TestPlugIn interface.
New in CppUnit 1.9.0:
----------------------
In short:
- Exploration of the test hierarchy without RTTI support
- Utility methods to find a test in the hierarchy
- TestPath to store/load the path to a specific test in the hierarchy
- Generic TestRunner
- Style sheet support added to XML ouput.
- CompilerOutputter supports run-time parametrization of error location format.
- Tracking of test suite run.
- Debugging and post-build testing of DLL using DllPlugInTester.
- Easy creation a test plug-in and test plug-in new example
* Test:
- Exploration of the test hierarchy without RTTI support:
Added Test::getChildTestCount() and Test::getChildTestAt() to walk the test hierarchy
without RTTI.
- Utility methods to find a test in the hierarchy:
Added Test::findTest(), Test::findTestPath() and Test::resolveTestPath().
* TestPath:
- A new class that store the path to a specific test (list of pointer). Can be
converted into a string and constructed from a string. Typically used with
TestRunner.
* TestListener:
- Added startSuite() and endSuite() callback that are called before and after a
test suite runs its child tests. See TestListener for detail and new example.
* CompilerOutputter:
- Support run-time parametrization of compiler error format. Support for gcc error
format added. See CompilerOutputter::setLocationFormat().
* XmlOutputter:
- Added style sheet support.
- XML structure change (see Compatibility break)
* DllPlugInTester: (src/msvc6/DllPlugInTester, in src/CppUnitLibraries.dsw)
- An application to load a DLL test plug-in and run the specified test. Test
result are reported using a CompilerOutputter. It can be used for post-build
testing, but to debug DLL too! See examples/msvc6/TestPlugIn/TestPlugIn.dsp
which demonstrate both.
* TestPlugInInterface (include/msvc6/TestPlugInInterface.h):
- Easy creation a test plug-in with the new macro CPPUNIT_TESTPLUGIN_IMPL
that implements and exports everything for you.
See examples/msvc6/EasyTestPlugIn for an example.
* Compatibility break:
- Test::toString() has been removed. Applies to all subclass of Test.
It was not used by the framework and was source of confusion with getName().
- TestCase::run(void) and TestCase::defaultResult() have been removed. Using the
run() method with a TestResult instead.
- XmlOutput: added a message element to the XML structure. The message associated
to a failure is now in the content of <Message> element instead of in the content
of the <FailedTest> element.
Changed from:
<FailedTest id="6">
<Name>test6</Name>
<FailureType>Error</FailureType>
error2
</FailedTest>
To:
<FailedTest id="6">
<Name>test6</Name>
<FailureType>Error</FailureType>
<Message>error2</Message>
</FailedTest>
* Deprecated:
- CompilerOutputter::defaultOutputter(): use default constructor instead.
* Bug fix:
- XmlOutputter: did not escape content (bug #540944).
- Included qt/examples in distribution
- Removed dependency of MfcTestRunner on DSPlugIn. It should now compile with
VC++ 7.
New in CppUnit 1.8.0:
----------------------
In short:
- new assertions
- new facilities to write custom assertions
- new macros to define test case in your fixture
- registration of test fixture in named suite
- xml & compiler format test result output
- a new graphic test runner for the QT library
- MFC test runner window is resizable
- cppunit as a DLL
- Unicode support for MFC test runner.
- architecture clean-up: TestResultCollector extracted from TestResult.
- architecture clean-up: TestFixture extracted from TestCase.
- cookbook and documentation updated.
* New assertion (TestAssert.h):
CPPUNIT_FAIL(message) : equivalent to CPPUNIT_ASSERT_MESSAGE( message, false )
CPPUNIT_ASSERT_EQUAL_MESSAGE( expectedValue, actualValue, additionalMessage ):
behave like CPPUNIT_ASSERT_EQUAL but allow to add some contextual information.
* New macros to write test case (HelperMacros.h):
CPPUNIT_TEST_EXCEPTION that expect an exception of a specified type to
be thrown.
CPPUNIT_TEST_FAIL that expect a test to fail.
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION to register a suite in a named suite. See
cppunittest example for a demo.
* TextTestRunner (TextTestRunner.h):
-run() returns a boolean indicating is the run was successful.
-the constructor and setOutputter() allow you do define a specific outputter
to print the test result (CompilerOutputter, TextOutputter, XmlOutputter...)
-result() provide access to the result of the test run.
-eventManager() give access to the TestResult, allowing you to register others
TestListener.
* TestResult (TestResult.h):
- That class has been splitted in two: TestResult and TestResultCollector.
- TestResult manages the TestListener (registration and event dispatch), as
well as the stop flag indicating if the current test run should be interrupted.
All other responsabilites have been moved to TestResultCollector.
- TestResult no longer hold the result of the test run (this is done by
TestResultCollector which is a TestListener).
* TestListener (TestListener.h):
- all failures and errors are reported using a single method:
virtual void addFailure( const TestFailure &failure )
=> the failure object life time is limited to that of the method call.
Use TestFailure::isError() to distinguish error from failure.
Use TestFailure::clone() to obtain a duplicate of the failure.
* New helpers to construct your own assertion (Asserter.h):
It is now very easy to create your own assertion macro with failure
location.
Asserter namespace contains functions used to construct and throw exception
to report failure. See Asserter documentation for an example of usage, and
examples/cppunittest/XmlUniformiser.h for a real life example.
CPPUNIT_SOURCELINE() macro have been added (SourceLine.h). It captures the
failure location in a SourceLine object. Use it to write your own macros.
Asserter namespace contains functions used to construct and throw exception
to report failure. See Asserter documentation for an example of usage, and
examples/cppunittest/XmlUniformiser.h for a real life example.
* TestListener (TestListener.h):
- TestSucesssListener : a simple listener that checks if a test has failed.
- TestResultCollector : store all the test result. This class has been
extracted from the hold TestResult class.
- TextTestProgressListener : print dot on cout to each time a test ends.
Letter 'F' and 'E' are printed when a failure or an error occurs.
* Output (Outputter.h):
- XML output: You can dump the TestResult as an XML document using
XmlOutputter. See examples/cppunittest/XmlOutputterTest.cpp for document
structure and usage.
- Compiler compatible output : CompilerOutputter print the result in a
compiler compatible format. You can use your IDE to jump to the first
failure. See examples/cppunittest/CppUniTestMain.cpp for an example of usage.
- Text output : replace the deprecated TextTestResult. Print the result in
a human readable format.
* NotEqualException constructor take an additional message (usually used to
point out where the difference occured between the expected and actual value)
that can be retreived with additionalMessage(). See Asserter documentation for
an example of usage.
* CppUnit
- CppUnit can be compiled as a DLL (WIN32 platform).
DLL can be generated by the cppunit_dll.dsp project. You must define the
pre-processor symbol CPPUNIT_DLL when linking against CppUnit DLL.
See cppunittests examples for an example.
* TestRunner
- Qt TestRunner : a test runner for the Qt library (http://www.trolltech.com).
See examples/qt for an example of use.
- MFC TestRunner : the dialog can now be resized. List view column sizes,
as well as the dialog size, are saved. Unicode configurations have been added.
* Deprecated
- TextTestResult : use the test listener TextTestProgressListener and the
ouputter TextOuputter instead.
- Methods having fileName, lineNumber as parameter. Usually replaced by
a similar method that take a SourceLine parameter. Exception and
TestAssert are impacted.
- TestRegistryFactory::registerFactory( const std::string &name,
TestFactory *factory ).
You must define the symbol CPPUNIT_ENABLE_SOURCELINE_DEPRECATED to enable
old Exception constructor, UNKNOWNFILENAME and UNKNOWNLINENUMBER, as well
as function defined in the TestAssert namespace. The exception construction
and throwing as been moved to Asserter namespace.
* Compatibility break:
TestResult has been splitted in two class. TestResultCollector compatibility
breaks refer to the methods that were previously in TestResult.
- TestListener::addError() was removed. addFailure() is used to report
any kind of failure.
- TestResultCollector::errors() was removed. Use failures() instead.
- TestResultCollector::failures() now reports all kind of failures.
- TestResultCollector::failures() returns a const reference.
- void TestListener::addFailure( TestFailure *failure ) was removed.
- void TestListener::addError( TestFailure *failure ) signature changed.
- CPPUNIT_ASSERT_EQUAL_MESSAGE: changed arguments order. 'message' is now
the first argument instead of the last (like CPPUNIT_ASSERT_MESSAGE).
Notes that CPPUNIT_ASSERT_EQUAL was introduced in release 1.7.3.
- directory for TestRunners as moved from cppunitui/ to cppunit/ui/ (concern
only users of release 1.7.10)
* Bug fix:
- test ExceptionTest.testAssignment() don't fail anymore on VC++. See FAQ
for detail.
New in CppUnit 1.6.1
--------------------
* This is a bug-fixing release.
New in CppUnit 1.6.0
--------------------
* All CppUnit macros now begin with "CPPUNIT_".
Macros CU_TEST_SUITE, CU_TEST, CU_TEST_SUITE_END, CU_TEST_SUB_SUITE,
and CU_TEST_SUITE_REGISTRATION are renamed but are otherwise unchanged;
they take the same arguments, and have the same effect. The old-style
macros can be used if your sources #define CPPUNIT_ENABLE_CU_TEST_MACROS
to 1 before including any CppUnit headers.
Macros assert, assertEqual, and assertDoublesEqual, have been replaced
by CPPUNIT_ASSERT, CPPUNIT_ASSERT_EQUAL, and CPPUNIT_ASSERT_DOUBLES_EQUAL,
respectively. Macro assertLongsEqual is replaced by CPPUNIT_ASSERT_EQUAL.
The old assert macros can be used if your sources #define
CPPUNIT_ENABLE_NAKED_ASSERT to 1 before including any CppUnit headers.
The old macro names are deprecated and will vanish in a future version
of CppUnit.
* Equality assertion CPPUNIT_ASSERT_EQUAL(expected,actual) can test
any type of expression. The types of "expected" and "actual" must
be the same; use a cast if necessary.
* Equality tested using CPPUNIT_ASSERT_EQUAL may be re-defined using
a traits class. Ditto for the string representation used in the
diagnostic messages.
* New assertion with arbitrary message: CPPUNIT_ASSERT_MESSAGE.
* A test case obtained using class TestCaller may check that
a particular exception is thrown.
* CppUnit has a test suite for itself!
* VC++ integration for MFC TestRunner.