Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorAlexander Stein2019-08-07 22:39:01 +0200
committerMartin Hořeňovský2019-10-27 18:02:14 +0100
commit2fbd66c51cbf3a406dc6bb8ddc6b9a0b96077a72 (patch)
treee62dd130cbeca1bb6f77920b18efb4328eecb0c9 /include
parent51b29ced1ac2bde83d977283f6e0b4f871898b8a (diff)
downloadcatch3-2fbd66c51cbf3a406dc6bb8ddc6b9a0b96077a72.tar.gz
Improve JUnit failure report
The JUnit report is improved in that: * The message shows the testing condition, not the result * The actual message has similar output than the console one
Diffstat (limited to 'include')
-rw-r--r--include/reporters/catch_reporter_junit.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/include/reporters/catch_reporter_junit.cpp b/include/reporters/catch_reporter_junit.cpp
index e8375862..f47f58f7 100644
--- a/include/reporters/catch_reporter_junit.cpp
+++ b/include/reporters/catch_reporter_junit.cpp
@@ -12,6 +12,7 @@
#include "../internal/catch_tostring.h"
#include "../internal/catch_reporter_registrars.hpp"
+#include "../internal/catch_text.h"
#include <cassert>
#include <sstream>
@@ -244,10 +245,25 @@ namespace Catch {
XmlWriter::ScopedElement e = xml.scopedElement( elementName );
- xml.writeAttribute( "message", result.getExpandedExpression() );
+ xml.writeAttribute( "message", result.getExpression() );
xml.writeAttribute( "type", result.getTestMacroName() );
ReusableStringStream rss;
+ if (stats.totals.assertions.total() > 0) {
+ rss << "FAILED" << ":\n";
+ if (result.hasExpression()) {
+ rss << " ";
+ rss << result.getExpressionInMacro();
+ rss << '\n';
+ }
+ if (result.hasExpandedExpression()) {
+ rss << "with expansion:\n";
+ rss << Column(result.getExpandedExpression()).indent(2) << '\n';
+ }
+ } else {
+ rss << '\n';
+ }
+
if( !result.getMessage().empty() )
rss << result.getMessage() << '\n';
for( auto const& msg : stats.infoMessages )