diff options
author | Christian Stenger <christian.stenger@theqtcompany.com> | 2015-05-13 16:07:31 +0200 |
---|---|---|
committer | Christian Stenger <christian.stenger@theqtcompany.com> | 2015-06-12 13:15:53 +0300 |
commit | 4605814c1d48f31fd150f32c2687596aeb3cb74e (patch) | |
tree | e5a740eac23f861482df44824dd63a628b736d93 /plugins/autotest/testsquishtools.cpp | |
parent | 9d4509540b7a67fcb4f4087708eb207164bdee5f (diff) | |
download | qt-creator-4605814c1d48f31fd150f32c2687596aeb3cb74e.tar.gz |
Parse Squish's XML output and put it on results pane
Change-Id: I5206a30f11b96bd0ab1a3a360b8f5e8fec0fe5f1
Reviewed-by: Riitta-Leena Miettinen <riitta-leena.miettinen@theqtcompany.com>
Reviewed-by: Robert Loehning <robert.loehning@theqtcompany.com>
Diffstat (limited to 'plugins/autotest/testsquishtools.cpp')
-rw-r--r-- | plugins/autotest/testsquishtools.cpp | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/plugins/autotest/testsquishtools.cpp b/plugins/autotest/testsquishtools.cpp index 49739271ee..62bde4e62b 100644 --- a/plugins/autotest/testsquishtools.cpp +++ b/plugins/autotest/testsquishtools.cpp @@ -21,6 +21,7 @@ #include "squishsettings.h" #include "testsquishtools.h" #include "testresultspane.h" +#include "squishxmloutputhandler.h" #include <QDebug> // TODO remove @@ -56,10 +57,16 @@ TestSquishTools::TestSquishTools(QObject *parent) m_state(Idle), m_currentResultsXML(0), m_resultsFileWatcher(0), - m_testRunning(false) + m_testRunning(false), + m_xmlOutputHandler(0) { + TestResultsPane *resultPane = TestResultsPane::instance(); connect(this, &TestSquishTools::logOutputReceived, - TestResultsPane::instance(), &TestResultsPane::addLogoutput, Qt::QueuedConnection); + resultPane, &TestResultsPane::addLogoutput, Qt::QueuedConnection); + connect(this, &TestSquishTools::squishTestRunStarted, + resultPane, &TestResultsPane::clearContents); + connect(this, &TestSquishTools::squishTestRunFinished, + resultPane, &TestResultsPane::updateSquishSummaryLabel); } TestSquishTools::~TestSquishTools() @@ -80,6 +87,9 @@ TestSquishTools::~TestSquishTools() delete m_serverProcess; m_serverProcess = 0; } + + if (m_xmlOutputHandler) + delete m_xmlOutputHandler; } struct SquishToolsSettings @@ -135,6 +145,12 @@ void TestSquishTools::runTestCases(const QString &suitePath, const QStringList & << QLatin1String("--resultdir") << QDir::toNativeSeparators(m_currentResultsDirectory); + if (m_xmlOutputHandler) + delete m_xmlOutputHandler; + m_xmlOutputHandler = new SquishXmlOutputHandler(this); + connect(this, &TestSquishTools::resultOutputCreated, + m_xmlOutputHandler, &SquishXmlOutputHandler::outputAvailable, Qt::QueuedConnection); + m_testRunning = true; emit squishTestRunStarted(); startSquishServer(RunTestRequested); @@ -212,9 +228,14 @@ void TestSquishTools::setState(TestSquishTools::State state) if (m_testCases.isEmpty()) { m_request = ServerStopRequested; stopSquishServer(); - // TODO merge result files + QString error; + SquishXmlOutputHandler::mergeResultFiles(m_reportFiles, m_currentResultsDirectory, + QDir(m_suitePath).dirName(), &error); + if (!error.isEmpty()) + QMessageBox::critical(Core::ICore::dialogParent(), tr("Error"), error); logrotateTestResults(); } else { + m_xmlOutputHandler->clearForNextRun(); startSquishRunner(); } break; @@ -590,7 +611,7 @@ void TestSquishTools::onRunnerOutput(const QString) if (firstNonWhitespace(output) == '<') { // output that must be used for the TestResultsPane - qDebug() << "RunnerOutput:" << output; + emit resultOutputCreated(output); } else { foreach (const QByteArray &line, output.split('\n')) { const QByteArray trimmed = line.trimmed(); |