diff options
| author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2021-08-03 14:27:45 +0200 |
|---|---|---|
| committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2021-08-10 18:06:36 +0200 |
| commit | 4632be1b4d8c5037c83b7c006850da73b590180e (patch) | |
| tree | 0be0a81e2607e3c40e171c78739a9ed326958c6a /src/testlib/qtestjunitstreamer.cpp | |
| parent | c08d56be1f833f98549e32d900182c33538d68c0 (diff) | |
testlib: Don't write redundant log message information in JUnit reporter
The separation between <system-out> and <system-err> is sufficient, and
we can't expect consumers to interpret our custom comment format.
The type of the text node has been renamed to more accurately identify
its purpose.
Pick-to: 6.2
Change-Id: I63c8ff17529fc087e1b695698350a6711eb5e68d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/testlib/qtestjunitstreamer.cpp')
| -rw-r--r-- | src/testlib/qtestjunitstreamer.cpp | 43 |
1 files changed, 6 insertions, 37 deletions
diff --git a/src/testlib/qtestjunitstreamer.cpp b/src/testlib/qtestjunitstreamer.cpp index 8176205cbb4..d8c73505db3 100644 --- a/src/testlib/qtestjunitstreamer.cpp +++ b/src/testlib/qtestjunitstreamer.cpp @@ -82,20 +82,8 @@ void QTestJUnitStreamer::formatStart(const QTestElement *element, QTestCharBuffe char indent[20]; indentForElement(element, indent, sizeof(indent)); - // Messages/errors are written as CDATA within system-out, system-err, - // error, and failure respectively, comments elsewhere - if (element->elementType() == QTest::LET_Message) { - switch (element->parentElement()->elementType()) { - case QTest::LET_SystemOutput: - case QTest::LET_SystemError: - case QTest::LET_Failure: - case QTest::LET_Error: - QTest::qt_asprintf(formatted, "%s<![CDATA[", indent); - break; - default: - QTest::qt_asprintf(formatted, "%s<!--", indent); - break; - } + if (element->elementType() == QTest::LET_Text) { + QTest::qt_asprintf(formatted, "%s<![CDATA[", indent); return; } @@ -125,15 +113,8 @@ void QTestJUnitStreamer::formatAttributes(const QTestElement* element, const QTe QTest::AttributeIndex attrindex = attribute->index(); - // For messages we only want to output the `message' attribute value - if (element && element->elementType() == QTest::LET_Message - && (element->parentElement()->elementType() == QTest::LET_SystemOutput - || element->parentElement()->elementType() == QTest::LET_SystemError - || element->parentElement()->elementType() == QTest::LET_Failure - || element->parentElement()->elementType() == QTest::LET_Error)) { - - if (attrindex != QTest::AI_Message) return; - + if (element && element->elementType() == QTest::LET_Text) { + QTEST_ASSERT(attrindex == QTest::AI_Value); QXmlTestLogger::xmlCdata(formatted, attribute->value()); return; } @@ -149,20 +130,8 @@ void QTestJUnitStreamer::formatAfterAttributes(const QTestElement *element, QTes if (!element || !formatted ) return; - // Messages are written as CDATA within system-out, system-err, - // error, and failure respectively, comments elsewhere - if (element->elementType() == QTest::LET_Message) { - switch (element->parentElement()->elementType()) { - case QTest::LET_SystemOutput: - case QTest::LET_SystemError: - case QTest::LET_Failure: - case QTest::LET_Error: - QTest::qt_asprintf(formatted, "]]>\n"); - break; - default: - QTest::qt_asprintf(formatted, " -->\n"); - break; - } + if (element->elementType() == QTest::LET_Text) { + QTest::qt_asprintf(formatted, "]]>\n"); return; } |
