• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeunittest
 

tdeunittest

  • KUnitTest
  • Runner
Public Slots | Signals | Public Member Functions | Static Public Member Functions | List of all members
KUnitTest::Runner Class Reference

#include <runner.h>

Inherits TQObject.

Public Slots

int runTests ()
 
void runTest (const char *name)
 
void runMatchingTests (const TQString &prefix)
 
void reset ()
 

Signals

void finished (const char *name, Tester *test)
 
void invoke ()
 

Public Member Functions

RegistryType & registry ()
 
int numberOfTestCases ()
 
int numberOfTests () const
 
int numberOfPassedTests () const
 
int numberOfFailedTests () const
 
int numberOfExpectedFailures () const
 
int numberOfSkippedTests () const
 

Static Public Member Functions

static void registerTester (const char *name, Tester *test)
 
static Runner * self ()
 
static void loadModules (const TQString &folder, const TQString &query)
 
static void setDebugCapturingEnabled (bool enabled)
 

Detailed Description

The Runner class holds a list of registered Tester classes and is able to run those test cases. The Runner class follows the singleton design pattern, which means that you can only have one Runner instance. This instance can be retrieved using the Runner::self() method.

The registry is an object of type RegistryType, it is able to map the name of a test to a pointer to a Tester object. The registry is also a singleton and can be accessed via Runner::registry(). Since there is only one registry, which can be accessed at all times, test cases can be added without having to worry if a Runner instance is present or not. This allows for a design in which the KUnitTest library can be kept separate from the test case sources. Test cases (classes inheriting from Tester) can be added using the static registerTester(const char *name, Tester *test) method. Allthough most users will want to use the TDEUNITTEST_REGISTER_TESTER macro.

See also
TDEUNITTEST_REGISTER_TESTER

Definition at line 97 of file runner.h.

Constructor & Destructor Documentation

◆ Runner()

KUnitTest::Runner::Runner ( )
protected

Definition at line 111 of file runner.cpp.

Member Function Documentation

◆ finished

void KUnitTest::Runner::finished ( const char *  name,
Tester *  test 
)
signal

Emitted after a test is finished.

Parameters
nameThe name of the test.
testA pointer to the Tester object.

◆ loadModules()

void KUnitTest::Runner::loadModules ( const TQString &  folder,
const TQString &  query 
)
static

Load all modules found in the folder.

Parameters
folderThe folder where to look for modules.
queryA regular expression. Only modules which match the query will be run.

Definition at line 54 of file runner.cpp.

◆ numberOfExpectedFailures()

int KUnitTest::Runner::numberOfExpectedFailures ( ) const
Returns
The number of failed tests which were expected.

Definition at line 131 of file runner.cpp.

◆ numberOfFailedTests()

int KUnitTest::Runner::numberOfFailedTests ( ) const
Returns
The number of failed tests, this includes the number of expected failures.

Definition at line 126 of file runner.cpp.

◆ numberOfPassedTests()

int KUnitTest::Runner::numberOfPassedTests ( ) const
Returns
The number of passed tests.

Definition at line 121 of file runner.cpp.

◆ numberOfSkippedTests()

int KUnitTest::Runner::numberOfSkippedTests ( ) const
Returns
The number of skipped tests.

Definition at line 136 of file runner.cpp.

◆ numberOfTestCases()

int KUnitTest::Runner::numberOfTestCases ( )
Returns
The number of registered test cases.

Definition at line 99 of file runner.cpp.

◆ numberOfTests()

int KUnitTest::Runner::numberOfTests ( ) const
Returns
The number of finished tests.

Definition at line 116 of file runner.cpp.

◆ registerTester()

void KUnitTest::Runner::registerTester ( const char *  name,
Tester *  test 
)
static

Registers a test case. A registry will be automatically created if necessary.

Parameters
nameThe name of the test case.
testA pointer to a Tester object.

Definition at line 49 of file runner.cpp.

◆ registry()

RegistryType & KUnitTest::Runner::registry ( )
Returns
The registry holding all the Tester objects.

Definition at line 94 of file runner.cpp.

◆ reset

void KUnitTest::Runner::reset ( )
slot

Reset the Runner in order to prepare it to run one or more tests again.

Definition at line 141 of file runner.cpp.

◆ runMatchingTests

void KUnitTest::Runner::runMatchingTests ( const TQString &  prefix)
slot

Call this slot to run tests with names starting with prefix.

Parameters
prefixOnly run tests starting with the string prefix.

Definition at line 196 of file runner.cpp.

◆ runTest

void KUnitTest::Runner::runTest ( const char *  name)
slot

Call this slot to run a single test.

Parameters
nameThe name of the test case. This name has to correspond to the name that was used to register the test. If the TDEUNITTEST_REGISTER_TESTER macro was used to register the test case then this name is the class name.

Definition at line 204 of file runner.cpp.

◆ runTests

int KUnitTest::Runner::runTests ( )
slot

Call this slot to run all the registered tests.

Returns
The number of finished tests.

Definition at line 151 of file runner.cpp.

◆ self()

Runner * KUnitTest::Runner::self ( )
static
Returns
The global Runner instance. If necessary an instance will be created.

Definition at line 104 of file runner.cpp.

◆ setDebugCapturingEnabled()

void KUnitTest::Runner::setDebugCapturingEnabled ( bool  enabled)
static

The runner can spit out special debug messages needed by the Perl script: tdeunittest_debughelper. This script can attach the debug output of each suite to the results in the KUnitTest GUI. Not very useful for console minded developers, so this static method can be used to disable those debug messages.

Parameters
enabledIf true the debug messages are enabled (default), otherwise they are disabled.

Definition at line 89 of file runner.cpp.


The documentation for this class was generated from the following files:
  • runner.h
  • runner.cpp

tdeunittest

Skip menu "tdeunittest"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

tdeunittest

Skip menu "tdeunittest"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeunittest by doxygen 1.9.4
This website is maintained by Timothy Pearson.