mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-29 16:53:30 +01:00
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
This commit is contained in:
parent
51b29ced1a
commit
2fbd66c51c
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
#include "../internal/catch_tostring.h"
|
#include "../internal/catch_tostring.h"
|
||||||
#include "../internal/catch_reporter_registrars.hpp"
|
#include "../internal/catch_reporter_registrars.hpp"
|
||||||
|
#include "../internal/catch_text.h"
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
@ -244,10 +245,25 @@ namespace Catch {
|
|||||||
|
|
||||||
XmlWriter::ScopedElement e = xml.scopedElement( elementName );
|
XmlWriter::ScopedElement e = xml.scopedElement( elementName );
|
||||||
|
|
||||||
xml.writeAttribute( "message", result.getExpandedExpression() );
|
xml.writeAttribute( "message", result.getExpression() );
|
||||||
xml.writeAttribute( "type", result.getTestMacroName() );
|
xml.writeAttribute( "type", result.getTestMacroName() );
|
||||||
|
|
||||||
ReusableStringStream rss;
|
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() )
|
if( !result.getMessage().empty() )
|
||||||
rss << result.getMessage() << '\n';
|
rss << result.getMessage() << '\n';
|
||||||
for( auto const& msg : stats.infoMessages )
|
for( auto const& msg : stats.infoMessages )
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user