1 /****************************************************************************
3 ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
6 ** This file is part of the test suite of the Qt Toolkit.
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
40 ****************************************************************************/
42 #ifndef PatternistSDK_TestSuite_H
43 #define PatternistSDK_TestSuite_H
48 #include "TestContainer.h"
58 namespace QPatternistSDK
61 class TestSuiteResult;
64 * @short Represents a test suite in the W3C XML Query Test Suite format.
66 * TestSuite contains the test suite's test cases and meta data.
68 * @ingroup PatternistSDK
69 * @author Frans Englich <frans.englich@nokia.com>
71 class Q_PATTERNISTSDK_EXPORT TestSuite : public TestContainer
75 * Describes the type of test suite.
79 XQuerySuite, ///< The test suite for XQuery
80 XsltSuite, ///< The test suite for XSLT
81 XsdSuite ///< The test suite for XML Schema
86 virtual QVariant data(const Qt::ItemDataRole role, int column) const;
89 * The version of the catalog test suite. For example, "0.8.0".
91 QString version() const;
94 * When the catalog was designed, last modified.
96 QDate designDate() const;
98 void setVersion(const QString &version);
99 void setDesignDate(const QDate &version);
102 * @return always @c null
104 virtual TestContainer *parent() const;
107 * Creates and returns a pointer to a TestSuite instance, which
108 * was instantiated from the XQuery Test Suite catalog file @p catalogFile.
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.
115 * This function blocks. Currently is only local files supported.
117 static TestSuite *openCatalog(const QUrl &catalogFile,
119 const bool useExclusionList,
122 void toXML(XMLWriter &receiver, TestCase *const tc) const;
125 * Evaluates all the test cases in this TestSuite, and returns
126 * it all in a TestSuiteResult.
128 TestSuiteResult *runSuite();
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.
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
145 static TestSuite *openCatalog(QIODevice *input,
147 const QUrl &fileName,
148 const bool useExclusionList,
160 // vim: et:ts=4:sw=4:sts=4