diff options
author | Tim Jenssen <tim.jenssen@theqtcompany.com> | 2014-12-19 11:22:53 +0100 |
---|---|---|
committer | Christian Stenger <christian.stenger@theqtcompany.com> | 2015-01-06 17:08:38 +0200 |
commit | be4c06fdaf0a8292f0ee9719ca1b53bfbeee6388 (patch) | |
tree | c231aaa0dc45160442f1566142a4e247901a152b | |
parent | 0c737c21ff2808a6615b2b433e3d5a9beeda58bb (diff) | |
download | qt-creator-be4c06fdaf0a8292f0ee9719ca1b53bfbeee6388.tar.gz |
introduce FaultyTestResult class
Change-Id: I5f20741492dbb3d553bea30a677965d46d6d8eb3
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
-rw-r--r-- | plugins/autotest/testresult.cpp | 5 | ||||
-rw-r--r-- | plugins/autotest/testresult.h | 6 | ||||
-rw-r--r-- | plugins/autotest/testrunner.cpp | 59 |
3 files changed, 35 insertions, 35 deletions
diff --git a/plugins/autotest/testresult.cpp b/plugins/autotest/testresult.cpp index 2ade2c42ae..6c8d0639da 100644 --- a/plugins/autotest/testresult.cpp +++ b/plugins/autotest/testresult.cpp @@ -21,6 +21,11 @@ namespace Autotest { namespace Internal { +FaultyTestResult::FaultyTestResult(ResultType result, const QString &description) + : TestResult(QString(), QString(), QString(), result, description) +{ +} + TestResult::TestResult(const QString &className, const QString &testCase, const QString &dataTag, ResultType result, const QString &description) : m_class(className), diff --git a/plugins/autotest/testresult.h b/plugins/autotest/testresult.h index 86d3517a9d..dcdf4ee0a1 100644 --- a/plugins/autotest/testresult.h +++ b/plugins/autotest/testresult.h @@ -76,6 +76,12 @@ private: // environment? }; +class FaultyTestResult : public TestResult +{ +public: + FaultyTestResult(ResultType result, const QString &description); +}; + bool operator==(const TestResult &t1, const TestResult &t2); } // namespace Internal diff --git a/plugins/autotest/testrunner.cpp b/plugins/autotest/testrunner.cpp index f3f7e37143..96a8968363 100644 --- a/plugins/autotest/testrunner.cpp +++ b/plugins/autotest/testrunner.cpp @@ -289,13 +289,11 @@ void processOutput() description.append(line); } } else if (xmlStartsWith(line, QLatin1String("<QtVersion>"), qtVersion)) { - TestResultsPane::instance()->addTestResult( - TestResult(QString(), QString(), QString(), ResultType::MESSAGE_INTERNAL, - QObject::tr("Qt Version: %1").arg(qtVersion))); + TestResultsPane::instance()->addTestResult(FaultyTestResult(ResultType::MESSAGE_INTERNAL, + QObject::tr("Qt Version: %1").arg(qtVersion))); } else if (xmlStartsWith(line, QLatin1String("<QTestVersion>"), qtestVersion)) { - TestResultsPane::instance()->addTestResult( - TestResult(QString(), QString(), QString(), ResultType::MESSAGE_INTERNAL, - QObject::tr("QTest Version: %1").arg(qtestVersion))); + TestResultsPane::instance()->addTestResult(FaultyTestResult(ResultType::MESSAGE_INTERNAL, + QObject::tr("QTest Version: %1").arg(qtestVersion))); } else { // qDebug() << "Unhandled line:" << line; // TODO remove } @@ -346,9 +344,8 @@ bool performExec(const QString &cmd, const QStringList &args, const QString &wor } if (runCmd.isEmpty()) { - TestResultsPane::instance()->addTestResult( - TestResult(QString(), QString(), QString(), ResultType::MESSAGE_FATAL, - QObject::tr("*** Could not find command '%1' ***").arg(cmd))); + TestResultsPane::instance()->addTestResult(FaultyTestResult(ResultType::MESSAGE_FATAL, + QObject::tr("*** Could not find command '%1' ***").arg(cmd))); return false; } @@ -369,9 +366,8 @@ bool performExec(const QString &cmd, const QStringList &args, const QString &wor if (m_currentFuture->isCanceled()) { m_runner->kill(); m_runner->waitForFinished(); - TestResultsPane::instance()->addTestResult( - TestResult(QString(), QString(), QString(), ResultType::MESSAGE_FATAL, - QObject::tr("*** Test Run canceled by user ***"))); + TestResultsPane::instance()->addTestResult(FaultyTestResult(ResultType::MESSAGE_FATAL, + QObject::tr("*** Test Run canceled by user ***"))); } qApp->processEvents(); } @@ -382,10 +378,8 @@ bool performExec(const QString &cmd, const QStringList &args, const QString &wor if (m_runner->state() != QProcess::NotRunning) { m_runner->kill(); m_runner->waitForFinished(); - TestResultsPane::instance()->addTestResult( - TestResult(QString(), QString(), QString(), ResultType::MESSAGE_FATAL, - QObject::tr("*** Test Case canceled due to timeout ***\n" - "Maybe raise the timeout?"))); + TestResultsPane::instance()->addTestResult(FaultyTestResult(ResultType::MESSAGE_FATAL, + QObject::tr("*** Test Case canceled due to timeout ***\nMaybe raise the timeout?"))); } return false; } @@ -444,11 +438,10 @@ void TestRunner::runTests() foreach (TestConfiguration *config, m_selectedTests) if (!config->project()) { toBeRemoved.append(config); - TestResultsPane::instance()->addTestResult( - TestResult(QString(), QString(), QString(), ResultType::MESSAGE_WARN, - tr("*** Project is null for '%1' - removing from Test Run ***\n" - "This might be the case for a faulty environment or similar." - ).arg(config->displayName()))); + TestResultsPane::instance()->addTestResult(FaultyTestResult(ResultType::MESSAGE_WARN, + tr("*** Project is null for '%1' - removing from Test Run ***\n" + "This might be the case for a faulty environment or similar." + ).arg(config->displayName()))); } foreach (TestConfiguration *config, toBeRemoved) { m_selectedTests.removeOne(config); @@ -456,19 +449,17 @@ void TestRunner::runTests() } if (m_selectedTests.empty()) { - TestResultsPane::instance()->addTestResult( - TestResult(QString(), QString(), QString(), ResultType::MESSAGE_WARN, - tr("*** No tests selected - canceling Test Run ***"))); + TestResultsPane::instance()->addTestResult(FaultyTestResult(ResultType::MESSAGE_WARN, + tr("*** No tests selected - canceling Test Run ***"))); return; } ProjectExplorer::Project *project = m_selectedTests.at(0)->project(); if (!project) { - TestResultsPane::instance()->addTestResult( - TestResult(QString(), QString(), QString(), ResultType::MESSAGE_WARN, - tr("*** Project is null - canceling Test Run ***\n" - "Actually only Desktop kits are supported - make sure the " - "current active kit is a Desktop kit."))); + TestResultsPane::instance()->addTestResult(FaultyTestResult(ResultType::MESSAGE_WARN, + tr("*** Project is null - canceling Test Run ***\n" + "Actually only Desktop kits are supported - make sure the " + "current active kit is a Desktop kit."))); return; } @@ -476,9 +467,8 @@ void TestRunner::runTests() ProjectExplorer::Internal::ProjectExplorerSettings pes = pep->projectExplorerSettings(); if (pes.buildBeforeDeploy) { if (!project->hasActiveBuildSettings()) { - TestResultsPane::instance()->addTestResult( - TestResult(QString(), QString(), QString(), ResultType::MESSAGE_FATAL, - tr("*** Project is not configured - canceling Test Run ***"))); + TestResultsPane::instance()->addTestResult(FaultyTestResult(ResultType::MESSAGE_FATAL, + tr("*** Project is not configured - canceling Test Run ***"))); return; } buildProject(project); @@ -487,9 +477,8 @@ void TestRunner::runTests() } if (!m_buildSucceeded) { - TestResultsPane::instance()->addTestResult( - TestResult(QString(), QString(), QString(), ResultType::MESSAGE_FATAL, - tr("*** Build failed - canceling Test Run ***"))); + TestResultsPane::instance()->addTestResult(FaultyTestResult(ResultType::MESSAGE_FATAL, + tr("*** Build failed - canceling Test Run ***"))); return; } } |