|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the test suite of the Qt Toolkit. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:LGPL$ |
|
10 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
15 ** |
|
16 ** GNU Lesser General Public License Usage |
|
17 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 ** General Public License version 2.1 as published by the Free Software |
|
19 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 ** packaging of this file. Please review the following information to |
|
21 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 ** |
|
24 ** In addition, as a special exception, Nokia gives you certain additional |
|
25 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 ** |
|
28 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 |
|
42 #ifndef PatternistSDK_TestSuite_H |
|
43 #define PatternistSDK_TestSuite_H |
|
44 |
|
45 #include <QDate> |
|
46 #include <QString> |
|
47 |
|
48 #include "TestContainer.h" |
|
49 |
|
50 QT_BEGIN_HEADER |
|
51 |
|
52 QT_BEGIN_NAMESPACE |
|
53 |
|
54 class QIODevice; |
|
55 class QUrl; |
|
56 class QVariant; |
|
57 |
|
58 namespace QPatternistSDK |
|
59 { |
|
60 class TestCase; |
|
61 class TestSuiteResult; |
|
62 |
|
63 /** |
|
64 * @short Represents a test suite in the W3C XML Query Test Suite format. |
|
65 * |
|
66 * TestSuite contains the test suite's test cases and meta data. |
|
67 * |
|
68 * @ingroup PatternistSDK |
|
69 * @author Frans Englich <frans.englich@nokia.com> |
|
70 */ |
|
71 class Q_PATTERNISTSDK_EXPORT TestSuite : public TestContainer |
|
72 { |
|
73 public: |
|
74 /** |
|
75 * Describes the type of test suite. |
|
76 */ |
|
77 enum SuiteType |
|
78 { |
|
79 XQuerySuite, ///< The test suite for XQuery |
|
80 XsltSuite, ///< The test suite for XSLT |
|
81 XsdSuite ///< The test suite for XML Schema |
|
82 }; |
|
83 |
|
84 TestSuite(); |
|
85 |
|
86 virtual QVariant data(const Qt::ItemDataRole role, int column) const; |
|
87 |
|
88 /** |
|
89 * The version of the catalog test suite. For example, "0.8.0". |
|
90 */ |
|
91 QString version() const; |
|
92 |
|
93 /** |
|
94 * When the catalog was designed, last modified. |
|
95 */ |
|
96 QDate designDate() const; |
|
97 |
|
98 void setVersion(const QString &version); |
|
99 void setDesignDate(const QDate &version); |
|
100 |
|
101 /** |
|
102 * @return always @c null |
|
103 */ |
|
104 virtual TestContainer *parent() const; |
|
105 |
|
106 /** |
|
107 * Creates and returns a pointer to a TestSuite instance, which |
|
108 * was instantiated from the XQuery Test Suite catalog file @p catalogFile. |
|
109 * |
|
110 * If loading went wrong, @c null is returned and @p errorMsg is set with a |
|
111 * human readable message string. However, @p catalogFile is not validated; |
|
112 * if the XML file is not valid against the XQTS task force's W3C XML Schema, the |
|
113 * behavior and result for this function is undefined. |
|
114 * |
|
115 * This function blocks. Currently is only local files supported. |
|
116 */ |
|
117 static TestSuite *openCatalog(const QUrl &catalogFile, |
|
118 QString &errorMsg, |
|
119 const bool useExclusionList, |
|
120 SuiteType type); |
|
121 |
|
122 void toXML(XMLWriter &receiver, TestCase *const tc) const; |
|
123 |
|
124 /** |
|
125 * Evaluates all the test cases in this TestSuite, and returns |
|
126 * it all in a TestSuiteResult. |
|
127 */ |
|
128 TestSuiteResult *runSuite(); |
|
129 |
|
130 private: |
|
131 /** |
|
132 * Essentially similar to open(const QUrl &, QString &errorMsg), |
|
133 * with the difference that it takes directly a QIODevice as input, |
|
134 * as opposed to a file name locating the catalog file to read. |
|
135 * |
|
136 * @param input the test suite catalog |
|
137 * @param fileName this URI is used for resolving relative paths inside |
|
138 * the catalog file into absolute. |
|
139 * @param errorMsg if an error occurs, this QString is set to contain the message. |
|
140 * Whether an error occurred can therefore be determined by checking if this variable |
|
141 * still is @c null after the call |
|
142 * @param useExclusionList whether the excludeTestGroups.txt file should be used |
|
143 * to exclude test groups for this catalog |
|
144 */ |
|
145 static TestSuite *openCatalog(QIODevice *input, |
|
146 QString &errorMsg, |
|
147 const QUrl &fileName, |
|
148 const bool useExclusionList, |
|
149 SuiteType type); |
|
150 QString m_version; |
|
151 QDate m_designDate; |
|
152 }; |
|
153 } |
|
154 |
|
155 QT_END_NAMESPACE |
|
156 |
|
157 QT_END_HEADER |
|
158 |
|
159 #endif |
|
160 // vim: et:ts=4:sw=4:sts=4 |