2014-10-07 15:51:02 +02:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
2015-02-19 08:09:02 +01:00
|
|
|
** Copyright (C) 2015 The Qt Company Ltd
|
2014-10-07 15:51:02 +02: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
|
2014-10-07 15:51:02 +02: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.
|
2014-10-07 15:51:02 +02: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
|
2014-10-07 15:51:02 +02:00
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifndef TESTRESULT_H
|
|
|
|
|
#define TESTRESULT_H
|
|
|
|
|
|
|
|
|
|
#include <QString>
|
|
|
|
|
#include <QColor>
|
2015-02-16 13:12:50 +01:00
|
|
|
#include <QMetaType>
|
2014-10-07 15:51:02 +02:00
|
|
|
|
|
|
|
|
namespace Autotest {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2015-01-08 13:46:28 +01:00
|
|
|
namespace Result{
|
|
|
|
|
enum Type {
|
2015-12-07 08:26:54 +01:00
|
|
|
Pass, FIRST_TYPE = Pass,
|
|
|
|
|
Fail,
|
|
|
|
|
ExpectedFail,
|
|
|
|
|
UnexpectedPass,
|
|
|
|
|
Skip,
|
|
|
|
|
BlacklistedPass,
|
|
|
|
|
BlacklistedFail,
|
|
|
|
|
Benchmark,
|
|
|
|
|
MessageDebug,
|
|
|
|
|
MessageWarn,
|
|
|
|
|
MessageFatal,
|
2015-09-23 07:14:25 +02:00
|
|
|
|
2015-12-07 08:26:54 +01:00
|
|
|
MessageInternal, INTERNAL_MESSAGES_BEGIN = MessageInternal,
|
|
|
|
|
MessageTestCaseStart,
|
|
|
|
|
MessageTestCaseSuccess,
|
|
|
|
|
MessageTestCaseWarn,
|
|
|
|
|
MessageTestCaseFail,
|
|
|
|
|
MessageTestCaseEnd,
|
|
|
|
|
MessageCurrentTest, INTERNAL_MESSAGES_END = MessageCurrentTest,
|
2015-09-23 07:14:25 +02:00
|
|
|
|
2015-12-07 08:26:54 +01:00
|
|
|
Invalid,
|
|
|
|
|
LAST_TYPE = Invalid
|
2014-10-07 15:51:02 +02:00
|
|
|
};
|
2015-01-08 13:46:28 +01:00
|
|
|
}
|
2014-10-07 15:51:02 +02:00
|
|
|
|
|
|
|
|
class TestResult
|
|
|
|
|
{
|
|
|
|
|
public:
|
2015-09-23 07:47:12 +02:00
|
|
|
TestResult();
|
|
|
|
|
TestResult(const QString &className);
|
2014-10-07 15:51:02 +02:00
|
|
|
|
|
|
|
|
QString className() const { return m_class; }
|
|
|
|
|
QString testCase() const { return m_case; }
|
|
|
|
|
QString dataTag() const { return m_dataTag; }
|
2015-01-08 13:46:28 +01:00
|
|
|
Result::Type result() const { return m_result; }
|
2014-10-07 15:51:02 +02:00
|
|
|
QString description() const { return m_description; }
|
|
|
|
|
QString fileName() const { return m_file; }
|
|
|
|
|
int line() const { return m_line; }
|
|
|
|
|
|
2015-01-08 12:51:01 +01:00
|
|
|
void setDescription(const QString &description) { m_description = description; }
|
2014-10-07 15:51:02 +02:00
|
|
|
void setFileName(const QString &fileName) { m_file = fileName; }
|
|
|
|
|
void setLine(int line) { m_line = line; }
|
2015-08-20 15:59:15 +02:00
|
|
|
void setResult(Result::Type type) { m_result = type; }
|
2015-09-23 07:47:12 +02:00
|
|
|
void setTestCase(const QString &testCase) { m_case = testCase; }
|
|
|
|
|
void setDataTag(const QString &dataTag) { m_dataTag = dataTag; }
|
2014-10-07 15:51:02 +02:00
|
|
|
|
2015-01-08 13:46:28 +01:00
|
|
|
static Result::Type resultFromString(const QString &resultString);
|
|
|
|
|
static Result::Type toResultType(int rt);
|
|
|
|
|
static QString resultToString(const Result::Type type);
|
|
|
|
|
static QColor colorForType(const Result::Type type);
|
2014-10-07 15:51:02 +02:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
QString m_class;
|
|
|
|
|
QString m_case;
|
|
|
|
|
QString m_dataTag;
|
2015-01-08 13:46:28 +01:00
|
|
|
Result::Type m_result;
|
2014-10-07 15:51:02 +02:00
|
|
|
QString m_description;
|
|
|
|
|
QString m_file;
|
|
|
|
|
int m_line;
|
|
|
|
|
// environment?
|
|
|
|
|
};
|
|
|
|
|
|
2014-12-19 11:22:53 +01:00
|
|
|
class FaultyTestResult : public TestResult
|
|
|
|
|
{
|
|
|
|
|
public:
|
2015-01-08 13:46:28 +01:00
|
|
|
FaultyTestResult(Result::Type result, const QString &description);
|
2014-12-19 11:22:53 +01:00
|
|
|
};
|
|
|
|
|
|
2014-10-07 15:51:02 +02:00
|
|
|
bool operator==(const TestResult &t1, const TestResult &t2);
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Autotest
|
|
|
|
|
|
2015-01-08 12:51:01 +01:00
|
|
|
Q_DECLARE_METATYPE(Autotest::Internal::TestResult)
|
2015-01-08 13:46:28 +01:00
|
|
|
Q_DECLARE_METATYPE(Autotest::Internal::Result::Type)
|
2014-10-21 13:10:37 +02:00
|
|
|
|
2014-10-07 15:51:02 +02:00
|
|
|
#endif // TESTRESULT_H
|