2015-01-16 13:44:24 +01:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
2015-02-19 08:09:02 +01:00
|
|
|
** Copyright (C) 2015 The Qt Company Ltd
|
2015-01-16 13:44:24 +01:00
|
|
|
** All rights reserved.
|
2015-02-19 08:09:02 +01:00
|
|
|
** For any questions to The Qt Company, please use contact form at
|
|
|
|
|
** http://www.qt.io/contact-us
|
2015-01-16 13:44:24 +01:00
|
|
|
**
|
|
|
|
|
** This file is part of the Qt Creator Enterprise Auto Test Add-on.
|
|
|
|
|
**
|
|
|
|
|
** Licensees holding valid Qt Enterprise licenses may use this file in
|
|
|
|
|
** accordance with the Qt Enterprise License Agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2015-02-19 08:09:02 +01:00
|
|
|
** a written agreement between you and The Qt Company.
|
2015-01-16 13:44:24 +01:00
|
|
|
**
|
|
|
|
|
** If you have questions regarding the use of this file, please use
|
2015-02-19 08:09:02 +01:00
|
|
|
** contact form at http://www.qt.io/contact-us
|
2015-01-16 13:44:24 +01:00
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifndef TESTXMLOUTPUTREADER_H
|
|
|
|
|
#define TESTXMLOUTPUTREADER_H
|
|
|
|
|
|
2015-02-18 15:40:32 +01:00
|
|
|
#include "testresult.h"
|
2015-01-16 13:44:24 +01:00
|
|
|
|
2016-01-19 14:24:09 +01:00
|
|
|
#include <QFutureInterface>
|
2015-01-16 13:44:24 +01:00
|
|
|
#include <QObject>
|
|
|
|
|
#include <QString>
|
2016-01-20 08:26:10 +01:00
|
|
|
#include <QXmlStreamReader>
|
2015-01-16 13:44:24 +01:00
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
class QProcess;
|
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
|
|
|
|
namespace Autotest {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2015-12-09 09:46:33 +01:00
|
|
|
class TestOutputReader : public QObject
|
2015-01-16 13:44:24 +01:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
2016-01-19 14:24:09 +01:00
|
|
|
TestOutputReader(QFutureInterface<TestResult *> futureInterface,
|
2016-01-20 08:26:10 +01:00
|
|
|
QProcess *testApplication);
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
virtual void processOutput() = 0;
|
|
|
|
|
QFutureInterface<TestResult *> m_futureInterface;
|
|
|
|
|
QProcess *m_testApplication; // not owned
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class QtTestOutputReader : public TestOutputReader
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
QtTestOutputReader(QFutureInterface<TestResult *> futureInterface,
|
|
|
|
|
QProcess *testApplication);
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
void processOutput() override;
|
2015-12-09 09:46:33 +01:00
|
|
|
|
2016-01-19 14:24:09 +01:00
|
|
|
private:
|
2016-01-20 08:26:10 +01:00
|
|
|
enum CDATAMode
|
|
|
|
|
{
|
|
|
|
|
None,
|
|
|
|
|
DataTag,
|
|
|
|
|
Description,
|
|
|
|
|
QtVersion,
|
|
|
|
|
QtBuild,
|
|
|
|
|
QTestVersion
|
|
|
|
|
};
|
2015-09-23 07:47:12 +02:00
|
|
|
|
2016-01-20 08:26:10 +01:00
|
|
|
CDATAMode m_cdataMode = None;
|
|
|
|
|
QString m_className;
|
|
|
|
|
QString m_testCase;
|
|
|
|
|
QString m_dataTag;
|
|
|
|
|
Result::Type m_result = Result::Invalid;
|
|
|
|
|
QString m_description;
|
|
|
|
|
QString m_file;
|
|
|
|
|
int m_lineNumber = 0;
|
|
|
|
|
QString m_duration;
|
|
|
|
|
QXmlStreamReader m_xmlReader;
|
2015-01-16 13:44:24 +01:00
|
|
|
};
|
|
|
|
|
|
2016-01-20 08:26:10 +01:00
|
|
|
class GTestOutputReader : public TestOutputReader
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
GTestOutputReader(QFutureInterface<TestResult *> futureInterface,
|
|
|
|
|
QProcess *testApplication);
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
void processOutput() override;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
QString m_currentTestName;
|
|
|
|
|
QString m_currentTestSet;
|
|
|
|
|
QString m_description;
|
|
|
|
|
QByteArray m_unprocessed;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2015-01-16 13:44:24 +01:00
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Autotest
|
|
|
|
|
|
2015-12-09 09:46:33 +01:00
|
|
|
#endif // TESTOUTPUTREADER_H
|