forked from qt-creator/qt-creator
AutoTest: Fix handling of summary
Avoid overwriting already gathered results and handle
special cases like parameterized boost tests correctly.
Beside this take into account that fatals on the boost
side are treated as failures when printing the summary.
Amends 6ab7013579
.
Change-Id: I3815f79cbb4d16fd7b3d286617d79b30e94ccdd8
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -140,6 +140,7 @@ void BoostTestOutputReader::handleMessageMatch(const QRegularExpressionMatch &ma
|
||||
if (m_currentTest.isEmpty() || m_logLevel > LogLevel::UnitScope)
|
||||
m_currentTest = caseFromContent(content);
|
||||
m_result = ResultType::MessageFatal;
|
||||
++m_summary[ResultType::MessageFatal];
|
||||
m_description = content;
|
||||
} else if (content.startsWith("last checkpoint:")) {
|
||||
if (m_currentTest.isEmpty() || m_logLevel > LogLevel::UnitScope)
|
||||
@@ -337,8 +338,9 @@ void BoostTestOutputReader::processOutputLine(const QByteArray &outputLine)
|
||||
sendCompleteInformation();
|
||||
BoostTestResult *result = new BoostTestResult(id(), m_projectFile, QString());
|
||||
int failed = match.captured(1).toInt();
|
||||
int fatals = m_summary.value(ResultType::MessageFatal);
|
||||
QString txt = tr("%1 failures detected in %2.").arg(failed).arg(match.captured(3));
|
||||
int passed = (m_testCaseCount != -1) ? m_testCaseCount - failed : -1;
|
||||
int passed = qMax(0, m_testCaseCount - failed);
|
||||
if (m_testCaseCount != -1)
|
||||
txt.append(' ').append(tr("%1 tests passed.").arg(passed));
|
||||
result->setDescription(txt);
|
||||
@@ -346,7 +348,7 @@ void BoostTestOutputReader::processOutputLine(const QByteArray &outputLine)
|
||||
reportResult(TestResultPtr(result));
|
||||
if (m_reportLevel == ReportLevel::Confirm) { // for the final summary
|
||||
m_summary[ResultType::Pass] += passed;
|
||||
m_summary[ResultType::Fail] += failed;
|
||||
m_summary[ResultType::Fail] += failed - fatals;
|
||||
}
|
||||
m_testCaseCount = -1;
|
||||
return;
|
||||
|
@@ -376,13 +376,10 @@ int TestResultModel::resultTypeCount(ResultType type) const
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
for (const auto &resultsForId : m_testResultCount.values())
|
||||
result += resultsForId.value(type, 0);
|
||||
|
||||
for (const auto &id : m_reportedSummary.keys()) {
|
||||
if (int counted = m_testResultCount.value(id).value(type))
|
||||
result -= counted;
|
||||
result += m_reportedSummary[id].value(type);
|
||||
// if we got a result count from the framework prefer that over our counted results
|
||||
int reported = m_reportedSummary[id].value(type);
|
||||
result += reported != 0 ? reported : m_testResultCount.value(id).value(type);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
Reference in New Issue
Block a user