mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-10-31 20:27:11 +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:
		 Alexander Stein
					Alexander Stein
				
			
				
					committed by
					
						 Martin Hořeňovský
						Martin Hořeňovský
					
				
			
			
				
	
			
			
			 Martin Hořeňovský
						Martin Hořeňovský
					
				
			
						parent
						
							51b29ced1a
						
					
				
				
					commit
					2fbd66c51c
				
			| @@ -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 ) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user