diff --git a/src/plugins/autotest/qtest/qttestoutputreader.cpp b/src/plugins/autotest/qtest/qttestoutputreader.cpp index b668ea442f6..682d0323f17 100644 --- a/src/plugins/autotest/qtest/qttestoutputreader.cpp +++ b/src/plugins/autotest/qtest/qttestoutputreader.cpp @@ -279,7 +279,6 @@ void QtTestOutputReader::processXMLOutput(const QByteArray &outputLine) if (currentTag == QStringLiteral("TestFunction")) { sendFinishMessage(true); // TODO: bump progress? - m_dataTag.clear(); m_formerTestCase = m_testCase; m_testCase.clear(); } else if (currentTag == QStringLiteral("TestCase")) { @@ -503,6 +502,9 @@ void QtTestOutputReader::sendStartMessage(bool isFunction) void QtTestOutputReader::sendFinishMessage(bool isFunction) { + m_dataTag.clear(); + if (!isFunction) + m_testCase.clear(); TestResult result = createDefaultResult(); result.setResult(ResultType::TestEnd); if (!m_duration.isEmpty()) { diff --git a/src/plugins/autotest/qtest/qttestresult.cpp b/src/plugins/autotest/qtest/qttestresult.cpp index 581a334efc6..9cefca17b8c 100644 --- a/src/plugins/autotest/qtest/qttestresult.cpp +++ b/src/plugins/autotest/qtest/qttestresult.cpp @@ -164,11 +164,17 @@ static ResultHooks::DirectParentHook directParentHook(const QString &functionNam const QtTestData otherData = other.extraData().value(); if (result.result() == ResultType::TestStart) { + if (other.result() == ResultType::TestEnd) { + if (!dataTag.isEmpty()) + return false; + return functionName.isEmpty() ? otherData.m_function.isEmpty() + : functionName == otherData.m_function; + } + if (otherData.isDataTag()) { if (otherData.m_function == functionName) { if (dataTag.isEmpty()) { - // avoid adding function's TestCaseEnd to the data tag - *needsIntermediate = other.result() != ResultType::TestEnd; + *needsIntermediate = true; return true; } return otherData.m_dataTag == dataTag;