17
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef TESTRUNNER_H
|
|
19 |
#define TESTRUNNER_H
|
|
20 |
|
|
21 |
#include <QXmlDefaultHandler>
|
|
22 |
|
|
23 |
class QXmlStreamWriter;
|
|
24 |
class QXmlStreamReader;
|
|
25 |
|
|
26 |
class TestRunner : public QXmlDefaultHandler
|
|
27 |
{
|
|
28 |
public: // Constructors and destructor
|
|
29 |
TestRunner(const QString& name, const QString& combinedOutputFileName = QString() );
|
|
30 |
~TestRunner();
|
|
31 |
|
|
32 |
public: // New functions
|
|
33 |
|
|
34 |
int runTests(QObject& testObject);
|
|
35 |
void printResults();
|
|
36 |
|
|
37 |
protected: // From QXmlContentHandler
|
|
38 |
bool startElement(
|
|
39 |
const QString& namespaceURI,
|
|
40 |
const QString& localName,
|
|
41 |
const QString& qName,
|
|
42 |
const QXmlAttributes& atts);
|
|
43 |
|
|
44 |
bool endElement(
|
|
45 |
const QString& namespaceURI,
|
|
46 |
const QString& localName,
|
|
47 |
const QString& qName);
|
|
48 |
|
|
49 |
bool characters(const QString& ch);
|
|
50 |
|
|
51 |
private: // New functions
|
|
52 |
|
|
53 |
void parse(const QString& fileName);
|
|
54 |
void combineResults();
|
|
55 |
void appendToXml(QXmlStreamWriter& writer, QXmlStreamReader& reader, QString& caseName);
|
|
56 |
|
|
57 |
private: // Data
|
|
58 |
QStringList mTestRunParams;
|
|
59 |
QString mHomeDir;
|
|
60 |
int mTestCount;
|
|
61 |
QStringList mErrors;
|
|
62 |
bool mParsingIncidentElement;
|
|
63 |
bool mParsingDescriptionElement;
|
|
64 |
bool mCurrentTestFailed;
|
|
65 |
QString mCurrentTestName;
|
|
66 |
QString mCurrentTestFile;
|
|
67 |
int mCurrentTestFailureLine;
|
|
68 |
QString mCombinedOutputFileName;
|
|
69 |
QStringList mResultFiles;
|
|
70 |
};
|
|
71 |
|
|
72 |
|
|
73 |
#endif // TESTRUNNER_H
|