From 23eb4cc5804a1cf3a88365c47baf94063f081496 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Mon, 6 Feb 2017 16:14:06 +0000 Subject: [PATCH] Added stdout and stderr to XML Reporter --- include/reporters/catch_reporter_xml.hpp | 5 ++++ .../SelfTest/Baselines/xml.sw.approved.txt | 23 ++++++++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/include/reporters/catch_reporter_xml.hpp b/include/reporters/catch_reporter_xml.hpp index c470ceb0..df6eb07c 100644 --- a/include/reporters/catch_reporter_xml.hpp +++ b/include/reporters/catch_reporter_xml.hpp @@ -164,6 +164,11 @@ namespace Catch { if ( m_config->showDurations() == ShowDurations::Always ) e.writeAttribute( "durationInSeconds", m_testCaseTimer.getElapsedSeconds() ); + if( !testCaseStats.stdOut.empty() ) + m_xml.scopedElement( "StdOut" ).writeText( trim( testCaseStats.stdOut ), false ); + if( !testCaseStats.stdErr.empty() ) + m_xml.scopedElement( "StdErr" ).writeText( trim( testCaseStats.stdErr ), false ); + m_xml.endElement(); } diff --git a/projects/SelfTest/Baselines/xml.sw.approved.txt b/projects/SelfTest/Baselines/xml.sw.approved.txt index 137f55e2..ccb4864b 100644 --- a/projects/SelfTest/Baselines/xml.sw.approved.txt +++ b/projects/SelfTest/Baselines/xml.sw.approved.txt @@ -6799,7 +6799,14 @@ re>" - + + +A string sent directly to stdout + + +A string sent directly to stderr + + @@ -6859,7 +6866,12 @@ re>"
- + + +Message from section one +Message from section two + +
@@ -6908,7 +6920,12 @@ re>" - + + +hello +hello + +