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

KUnitTest

  • sources
  • kde-4.12
  • kdelibs
  • 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>
32 using 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 
42 namespace 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::Tester
Definition: tester.h:516
KUnitTest::TesterAutoregister::TesterAutoregister
TesterAutoregister(const char *name, Tester *test)
Definition: runner.h:200
tester.h
QString
QHash< QByteArray, Tester * >
QObject
prefix
QString prefix()
KUnitTest::TesterAutoregister
Definition: runner.h:194
kunittest_export.h
KUnitTest::Runner
Definition: runner.h:87
KUnitTest::Registry
QHash< QByteArray, Tester * > Registry
Definition: runner.h:68
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:52:07 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
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • 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