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

KUnitTest

  • kde3support
  • kunittest
runner.h
Go to the documentation of this file.
1
28#ifndef KUNITTEST_RUNNER_H
29#define KUNITTEST_RUNNER_H
30
31#include <iostream>
32using namespace std;
33
34#include <QtCore/QObject>
35#include <QtCore/QHash>
36#include <QtCore/QString>
37
38#include "kunittest_export.h"
39#include "tester.h"
40
41
42namespace KUnitTest
43{
49 #define KUNITTEST_SUITE(suite)\
50 static const QString s_kunittest_suite = suite;
51
61 #define KUNITTEST_REGISTER_TESTER( tester )\
62 static TesterAutoregister tester##Autoregister( QString(s_kunittest_suite + QString("::") + QString::fromLocal8Bit(#tester)).local8Bit() , new tester ())
63
64 #define KUNITTEST_REGISTER_NAMEDTESTER( name, tester )\
65 static TesterAutoregister tester##Autoregister( QString(s_kunittest_suite + QString("::") + QString::fromLocal8Bit(name)).local8Bit() , new tester ())
66
68 typedef QHash<QByteArray, Tester*> Registry;
69
87 class KUNITTEST_EXPORT Runner : public QObject
88 {
89 Q_OBJECT
90
91 public:
96 static void registerTester(const char *name, Tester *test);
97
100 Registry &registry();
101
104 static Runner *self();
105
108 int numberOfTestCases();
109
114 static void loadModules(const QString &folder, const QString &query);
115
122 static void setDebugCapturingEnabled(bool enabled);
123
124 private:
125 Registry m_registry;
126 static Runner *s_self;
127 static bool s_debugCapturingEnabled;
128
129 protected:
130 Runner();
131
132 public:
134 int numberOfTests() const;
135
137 int numberOfPassedTests() const;
138
140 int numberOfFailedTests() const;
141
143 int numberOfExpectedFailures() const;
144
146 int numberOfSkippedTests() const;
147
148 public Q_SLOTS:
152 int runTests();
153
159 void runTest(const char *name);
160
164 void runMatchingTests(const QString &prefix);
165
168 void reset();
169
170 Q_SIGNALS:
175 void finished(const char *name, Tester *test);
176 void invoke();
177
178 private:
179 void registerTests();
180
181 private:
182 int globalSteps;
183 int globalTests;
184 int globalPasses;
185 int globalFails;
186 int globalXFails;
187 int globalXPasses;
188 int globalSkipped;
189 };
190
194 class TesterAutoregister
195 {
196 public:
200 TesterAutoregister(const char *name, Tester *test)
201 {
202 if ( test->objectName().isNull())
203 test->setObjectName(QLatin1String(name));
204 Runner::registerTester(name, test);
205 }
206 };
207
208}
209
210#endif
KUnitTest::Runner::registerTester
static void registerTester(const char *name, Tester *test)
Definition: runner.cpp:51
KUnitTest::TesterAutoregister
Definition: runner.h:194
KUnitTest::Tester
Definition: tester.h:517
QHash
QObject
prefix
QString prefix()
kunittest_export.h
KUnitTest
Copyright (C) 2005 Jeroen Wijnhout Jeroen.Wijnhout@kdemail.net
Definition: module.h:35
KUnitTest::Registry
QHash< QByteArray, Tester * > Registry
Definition: runner.h:67
tester.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 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-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 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
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