CppUnit 2 todo

Author: Baptiste Lepilleur
Contact: blep@users.sourceforge.net

Contents

Moving CppUnit 2 to Open Test

Starting point

Currently, the framework has adopted CppUnit approach to driving testing. This means that the framework provides services for both TestDriver and TestRunner responsibility.

Since CppUnit is a testing framework, it should only provide the TestRunner for integration with Open Test.

What should be removed?

  • All stuffs concerning test reporting, output result must be removed (will likely be moved to OpenTest but will no longer be based on CppUnit classes).

Should at least include the following headers:

  • progresslistener.h
  • properties.h (should use OpenTest properties or some proxy)
  • testcontext.h (some stuff need to be preserved, see What need to be changed?)
  • testlistener.h
  • testresult.h (preserved some stuff, integrate some to the TestRunner)
  • testrunresult.h

What need to be changed?

  • Test should no longer be runnable
  • TestContext guard chain and protect functions should be moved to the TestRunner. The rest should be taken out => no more TestListener.
  • TestResult should be integrated to TestRunner.

Features to add

Test descriptive information

Provides a way to associate descriptive information to a test.

Warning: it should be designed/documented so that only the framework uses it to declare test.

Should also find a way to integrate this with test fixture declaration.

Test configuration information

Just before test execution, test descriptive information should be merged with test configuration information (configuration information overriding test descriptive information if they share properties).

A mean should be provided to the user to access a read only copy of those data.

Test result information

The user should be able to set test result information during the test run.

This can be used to add a line of log, set specific message, actual values, assertion location...

Logging stream

Provides a logging stream that associated logged data to the test.

Logged data should be sent to the TestDriver on each '\n'. This probably requires implementing a streambuffer.

This logging stream would be a singleton, like std::cout => CppUT::log.

Data written in the stream should be forwarded to the component managing TestInfo (TestRunner ?). This ensures that the correct threading strategy is used (one log per thread, one log for all thread...).

Checking assertions vs. aborting assertions

Checking assertions (opposed to aborting assertions) need to be added.

This should use the same mechanism as setCheckPointLocation():

  • setAssertionType( checkingAssertion )
  • setAssertionType( abortingAssertion )

The fail function checks the assertion type to determine if an assertion if thrown of is an assertion occurred.

It might also be interesting to see if removing Message is worth it. It could be replaced by direct update of the current assertion Properties.

Test plug-in wrapper application

A TestRunner wrapper application needs to be written for test plug-in support with Open test.

The wrapper application:

  • load the DLL
  • call a specific function on the DLL passing remaining command-line parameter

Features to enhance

Equality check

At the current time it is impossible to overload the equality check on older compiler without function template ordering support such as VC++ 6 (you must specialize the trait template)

The current implementation should be enhanced to detect if a specific overload is provided for comparison of AType and BType is provided, and automatically fallback on the generic == otherwise. This is similar to the convert to string trick used by stringize().

This would solve the overloading issue on older compiler without function template ordering support.