aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/autotest/catch
diff options
context:
space:
mode:
authorChristian Stenger <[email protected]>2022-09-05 08:24:10 +0200
committerChristian Stenger <[email protected]>2022-09-07 10:10:35 +0000
commitbabcdc7d10533232560f6d7cfb8dbe8192091c1b (patch)
tree1ab9fba6d778f022022b457d42c4aa4a9b56d5ce /src/plugins/autotest/catch
parent556b4c8fd0344de886e8f2bc7a6a644347d3443d (diff)
AutoTest: Report exceptions when running Catch2 tests
Inform the user about occurred exceptions and stop ignoring them. Fixes: QTCREATORBUG-28131 Change-Id: I24b2677aead06ea32ce8ac6a01bab68b0c4eb592 Reviewed-by: David Schulz <[email protected]>
Diffstat (limited to 'src/plugins/autotest/catch')
-rw-r--r--src/plugins/autotest/catch/catchoutputreader.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/plugins/autotest/catch/catchoutputreader.cpp b/src/plugins/autotest/catch/catchoutputreader.cpp
index a8c43732a94..9ec3006ab73 100644
--- a/src/plugins/autotest/catch/catchoutputreader.cpp
+++ b/src/plugins/autotest/catch/catchoutputreader.cpp
@@ -17,6 +17,7 @@ namespace CatchXml {
const char GroupElement[] = "Group";
const char TestCaseElement[] = "TestCase";
const char SectionElement[] = "Section";
+ const char ExceptionElement[] = "Exception";
const char ExpressionElement[] = "Expression";
const char ExpandedElement[] = "Expanded";
const char BenchmarkResults[] = "BenchmarkResults";
@@ -91,6 +92,10 @@ void CatchOutputReader::processOutputLine(const QByteArray &outputLineWithNewLin
if (attributes.value("failures").toInt() == 0)
if (!m_reportedSectionResult)
sendResult(ResultType::Pass);
+ } else if (m_currentTagName == CatchXml::ExceptionElement) {
+ recordTestInformation(m_xmlReader.attributes());
+ m_currentExpression = m_currentExpression.prepend(Tr::tr("Exception:"));
+ m_currentResult = ResultType::MessageFatal;
} else if (m_currentTagName == CatchXml::ExpressionElement) {
recordTestInformation(m_xmlReader.attributes());
if (m_xmlReader.attributes().value("success").toString() == QStringLiteral("true"))
@@ -116,6 +121,8 @@ void CatchOutputReader::processOutputLine(const QByteArray &outputLineWithNewLin
const auto text = m_xmlReader.text();
if (m_currentTagName == CatchXml::ExpandedElement) {
m_currentExpression.append(text);
+ } else if (m_currentTagName == CatchXml::ExceptionElement) {
+ m_currentExpression.append('\n').append(text.trimmed());
}
break;
}
@@ -246,7 +253,7 @@ void CatchOutputReader::sendResult(const ResultType result)
} else if (result == ResultType::TestEnd) {
catchResult->setDescription(Tr::tr("Finished executing %1 \"%2\"").arg(testOutputNodeToString().toLower())
.arg(catchResult->description()));
- } else if (result == ResultType::Benchmark) {
+ } else if (result == ResultType::Benchmark || result == ResultType::MessageFatal) {
catchResult->setDescription(m_currentExpression);
}