• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KUnitTest

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

#include <runner.h>

Inheritance diagram for KUnitTest::Runner:
Inheritance graph
[legend]

Public Slots

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

Signals

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

Public Member Functions

int numberOfExpectedFailures () const
 
int numberOfFailedTests () const
 
int numberOfPassedTests () const
 
int numberOfSkippedTests () const
 
int numberOfTestCases ()
 
int numberOfTests () const
 
Registry & registry ()
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
 QObject (QObject *parent, const char *name)
 
virtual  ~QObject ()
 
bool blockSignals (bool block)
 
QObject * child (const char *objName, const char *inheritsClass, bool recursiveSearch) const
 
const QObjectList & children () const
 
const char * className () const
 
bool connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const QObject *receiver, const char *method)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method)
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QByteArray > dynamicPropertyNames () const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
T findChild (const QString &name) const
 
QList< T > findChildren (const QRegExp &regExp) const
 
QList< T > findChildren (const QString &name) const
 
bool inherits (const char *className) const
 
void insertChild (QObject *object)
 
void installEventFilter (QObject *filterObj)
 
bool isA (const char *className) const
 
bool isWidgetType () const
 
void killTimer (int id)
 
virtual const QMetaObject * metaObject () const
 
void moveToThread (QThread *targetThread)
 
const char * name () const
 
const char * name (const char *defaultName) const
 
QString objectName () const
 
QObject * parent () const
 
QVariant property (const char *name) const
 
void removeChild (QObject *object)
 
void removeEventFilter (QObject *obj)
 
void setName (const char *name)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval)
 
QThread * thread () const
 

Static Public Member Functions

static void loadModules (const QString &folder, const QString &query)
 
static void registerTester (const char *name, Tester *test)
 
static Runner * self ()
 
static void setDebugCapturingEnabled (bool enabled)
 
- Static Public Member Functions inherited from QObject
bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 

Protected Member Functions

 Runner ()
 
- Protected Member Functions inherited from QObject
bool checkConnectArgs (const char *signal, const QObject *object, const char *method)
 
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const char *signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const char *signal)
 
int receivers (const char *signal) const
 
QObject * sender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 

Additional Inherited Members

- Static Protected Member Functions inherited from QObject
QByteArray normalizeSignalSlot (const char *signalSlot)
 
- Properties inherited from QObject
 objectName
 

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 Registry, 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 KUNITTEST_REGISTER_TESTER macro.

See also
KUNITTEST_REGISTER_TESTER

Definition at line 87 of file runner.h.

Constructor & Destructor Documentation

KUnitTest::Runner::Runner ( )
protected

Definition at line 117 of file runner.cpp.

Member Function Documentation

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.
void KUnitTest::Runner::invoke ( )
signal
void KUnitTest::Runner::loadModules ( const QString &  folder,
const QString &  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 56 of file runner.cpp.

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

Definition at line 137 of file runner.cpp.

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

Definition at line 132 of file runner.cpp.

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

Definition at line 127 of file runner.cpp.

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

Definition at line 142 of file runner.cpp.

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

Definition at line 103 of file runner.cpp.

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

Definition at line 122 of file runner.cpp.

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 51 of file runner.cpp.

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

Definition at line 98 of file runner.cpp.

void KUnitTest::Runner::reset ( )
slot

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

Definition at line 147 of file runner.cpp.

void KUnitTest::Runner::runMatchingTests ( const QString &  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 202 of file runner.cpp.

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 KUNITTEST_REGISTER_TESTER macro was used to register the test case then this name is the class name.

Definition at line 210 of file runner.cpp.

int KUnitTest::Runner::runTests ( )
slot

Call this slot to run all the registered tests.

Returns
The number of finished tests.

Definition at line 157 of file runner.cpp.

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

Definition at line 108 of file runner.cpp.

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

The runner can spit out special debug messages needed by the Perl script: kunittest_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 92 of file runner.cpp.


The documentation for this class was generated from the following files:
  • runner.h
  • runner.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:26:58 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KUnitTest

Skip menu "KUnitTest"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal