AutoTest: Fix appending test results with the same name

If two test cases had the same name but came from a different
executable the results pane still might have shown any later one
(badly) cascaded inside the first one. Avoid this by providing
an additional unique information (the respective executable for
the test case)

Task-number: QTCREATORBUG-18502
Change-Id: Ib071e389758b6269a9a90cc4c4afbcf86ca583ac
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2017-06-27 15:15:43 +02:00
parent 2a555a0da7
commit 625129d29c
11 changed files with 40 additions and 11 deletions

View File

@@ -41,6 +41,7 @@ static QString constructSourceFilePath(const QString &path, const QString &fileP
GTestOutputReader::GTestOutputReader(const QFutureInterface<TestResultPtr> &futureInterface,
QProcess *testApplication, const QString &buildDirectory)
: TestOutputReader(futureInterface, testApplication, buildDirectory)
, m_executable(testApplication ? testApplication->program() : QString())
{
}
@@ -75,7 +76,7 @@ void GTestOutputReader::processOutput(const QByteArray &outputLine)
m_futureInterface.reportResult(testResult);
m_description.clear();
} else if (disabledTests.exactMatch(line)) {
TestResultPtr testResult = TestResultPtr(new GTestResult());
TestResultPtr testResult = TestResultPtr(new GTestResult);
testResult->setResult(Result::MessageDisabledTests);
int disabled = disabledTests.cap(1).toInt();
testResult->setDescription(tr("You have %n disabled test(s).", 0, disabled));
@@ -106,7 +107,7 @@ void GTestOutputReader::processOutput(const QByteArray &outputLine)
m_futureInterface.reportResult(testResult);
} else if (newTestSetStarts.exactMatch(line)) {
m_currentTestSet = newTestSetStarts.cap(1);
TestResultPtr testResult = TestResultPtr(new GTestResult());
TestResultPtr testResult = TestResultPtr(new GTestResult);
testResult->setResult(Result::MessageCurrentTest);
testResult->setDescription(tr("Entering test set %1").arg(m_currentTestSet));
m_futureInterface.reportResult(testResult);
@@ -156,7 +157,7 @@ void GTestOutputReader::processOutput(const QByteArray &outputLine)
GTestResult *GTestOutputReader::createDefaultResult() const
{
GTestResult *result = new GTestResult(m_currentTestName);
GTestResult *result = new GTestResult(m_executable, m_currentTestName);
result->setTestSetName(m_currentTestSet);
result->setIteration(m_iteration);
return result;