forked from qt-creator/qt-creator
AutoTest: Fix adding finish message into results tree
For QTest based tests we added the function finish message wrongly to the last data tag when using data driven tests. Not crucial, but it would become so in a follow up. For finish messages we know that these only apply to test functions or cases - never data tags. This patch ensures we only add TestEnd messages to the corresponding TestStart. Change-Id: Idceb6e563e6f8c5f426e5604d4c533508583429c Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -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()) {
|
||||
|
@@ -164,11 +164,17 @@ static ResultHooks::DirectParentHook directParentHook(const QString &functionNam
|
||||
const QtTestData otherData = other.extraData().value<QtTestData>();
|
||||
|
||||
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;
|
||||
|
Reference in New Issue
Block a user