Print this page

QxCppUnit Library User Guide

This user gide describes how to use the QxCppUnit library.

QxCppUnit User Interface

The main window of a QxRunner for CppUnit (QxCppUnit) program closely resembles the 'standard' GUI of a QxRunner application. The only differences are the fewer filter buttons, the column headers and, well, the application icon color. Therefore see the QxRunner User Guide for the detailed user interface description.

The runner view shows the CppUnit test cases selectable for execution. The expected result types are:

Success The test case passed.
Warning An assertion failed. In CppUnit speech this is a 'failure' and is shown accordingly in the result column of the views.
Error The CppUnit library reported an error.

Writing a QxCppUnit Program

The Examples page in the QxCppUnit API Documentation explains in detail how the demo program for the QxCppUnit library is implemented. Use the approach presented there for your own test runner program.

Building the Program on Windows

It's assumed that you know how to build a Qt program on Windows, therefore just a few important points to be considered when using the Visual Studio 2005 IDE with CL version 14.x:

  • Make sure the compiler and linker options are compatible with the options used for building the QxCppUnit and Qt libraries.
  • Programs using the QxCppUnit DLL must be compiled with the QXCPPUNIT_DLL, QXRUNNER_DLL and CPPUNIT_DLL preprocessor definitions. This isn't required when linking with the static QxCppUnit library.
  • Set the appropriate pathnames for the compiler and linker so these tools find the include and library files of CppUnit, QxCppUnit, QxRunner and Qt. For example:

    $(CPPUNIT)\include $(QXRUNNER)\include $(QTDIR)\include
    $(QTDIR)\include\QtCore $(QTDIR)\include\QtGui


  • Link with the CppUnit, QxCppUnit, QxRunner, QtCore and QtGui libraries. For example when linking with the static debug libraries:

    cppunitd.lib qxcppunitd.lib qxrunnerd.lib qtmaind.lib QtCored4.lib QtGuid4.lib

Building the Program on Linux

It's assumed that you know how to build a Qt program on Linux. Writing a qmake project file probably is the easiest way to go. For example when linking with the static debug libraries:

TEMPLATE     = app
CONFIG      += qt warn_on debug
INCLUDEPATH += $$(CPPUNIT)/include $$(QXRUNNER)/include
LIBS        += -L$$(QXRUNNER)/lib -lqxcppunitd -lqxrunnerd
LIBS        += -L$$(CPPUNIT)/lib  -lcppunit
.
.
HEADERS = ...
SOURCES = ...