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

summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorPhil Nash2017-02-06 16:14:06 +0000
committerPhil Nash2017-02-06 16:14:06 +0000
commit23eb4cc5804a1cf3a88365c47baf94063f081496 (patch)
treefee6197000055234fa1c0b614d3283913a9b1497
parenta189387f49f129a3554c47426a0dfe176c5c0781 (diff)
downloadcatch3-23eb4cc5804a1cf3a88365c47baf94063f081496.tar.gz
Added stdout and stderr to XML Reporter
-rw-r--r--include/reporters/catch_reporter_xml.hpp5
-rw-r--r--projects/SelfTest/Baselines/xml.sw.approved.txt23
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>"
<OverallResult success="true"/>
</TestCase>
<TestCase name="Sends stuff to stdout and stderr">
- <OverallResult success="true"/>
+ <OverallResult success="true">
+ <StdOut>
+A string sent directly to stdout
+ </StdOut>
+ <StdErr>
+A string sent directly to stderr
+ </StdErr>
+ </OverallResult>
</TestCase>
<TestCase name="Some simple comparisons between doubles">
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/ApproxTests.cpp" >
@@ -6859,7 +6866,12 @@ re>"
<Section name="two">
<OverallResults successes="0" failures="1" expectedFailures="0"/>
</Section>
- <OverallResult success="false"/>
+ <OverallResult success="false">
+ <StdOut>
+Message from section one
+Message from section two
+ </StdOut>
+ </OverallResult>
</TestCase>
<TestCase name="StartsWith string matcher">
<Expression success="false" type="CHECK_THAT" filename="projects/<exe-name>/MiscTests.cpp" >
@@ -6908,7 +6920,12 @@ re>"
<OverallResult success="true"/>
</TestCase>
<TestCase name="Strings can be rendered with colour">
- <OverallResult success="true"/>
+ <OverallResult success="true">
+ <StdOut>
+hello
+hello
+ </StdOut>
+ </OverallResult>
</TestCase>
<TestCase name="Tabs and newlines show in output">
<Expression success="false" type="CHECK" filename="projects/<exe-name>/MiscTests.cpp" >