catch2/include/reporters/catch_reporter_junit.hpp

233 lines
8.9 KiB
C++
Raw Normal View History

2010-12-10 09:01:42 +01:00
/*
* Created by Phil on 26/11/2010.
* Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
*
* Distributed under the Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef TWOBLUECUBES_CATCH_REPORTER_JUNIT_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_REPORTER_JUNIT_HPP_INCLUDED
#include "../internal/catch_capture.hpp"
#include "../internal/catch_interfaces_reporter.h"
#include "../internal/catch_reporter_registrars.hpp"
#include "../internal/catch_xmlwriter.hpp"
2010-12-10 09:01:42 +01:00
2012-05-16 15:53:59 +02:00
namespace Catch {
class JunitReporter : public SharedImpl<IReporter> {
struct TestStats {
2011-01-31 11:10:20 +01:00
std::string m_element;
std::string m_resultType;
std::string m_message;
std::string m_content;
2010-12-10 09:01:42 +01:00
};
2012-05-16 15:53:59 +02:00
struct TestCaseStats {
Squashed commit of the following: commit 70c5ef9eede41e7061ff1af45b5babe0d7cde4ba Author: Phil Nash <github@philnash.me> Date: Tue Nov 13 21:46:01 2012 +0000 Regen single include commit 4ea535e5059a664cc393404b454f29e6dad0886e Author: Phil Nash <github@philnash.me> Date: Tue Nov 13 09:56:30 2012 +0000 Tidied up result enums commit 7717c29072013fd45e36d1bc48527927fa94cbed Author: Phil Nash <github@philnash.me> Date: Tue Nov 13 09:45:29 2012 +0000 Implemented CHECK_NOFAIL Previous commit missed some files commit d539da903032e5a6f2bf40d6d7d8e7874c860088 Author: Phil Nash <github@philnash.me> Date: Tue Nov 13 09:44:52 2012 +0000 Implemented CHECK_NO_FAIL commit af1a321860a8b63fb57fcade75ba7f33cad7400c Author: Phil Nash <github@philnash.me> Date: Sat Nov 10 18:46:39 2012 +0000 Regen single include commit f54ac5625e4702e1c032f7b5a7f4d9346c64f502 Author: Phil Nash <github@philnash.me> Date: Sat Nov 10 18:44:12 2012 +0000 New (combined) baselines commit defca58566653fd088f615c2979d7e7a681bf107 Author: Phil Nash <github@philnash.me> Date: Sat Nov 10 18:43:23 2012 +0000 negate() -> endExpression(), takes ResultDisposition commit b2ef99882590ccd3824ebca44cb9b4cfc42f4728 Author: Phil Nash <github@philnash.me> Date: Sat Nov 10 10:35:09 2012 +0000 Changed shouldNegate boolean to use part of ResultDisposition enum commit 1af13dba97474c2a0b33f1ca1919c80ea4f95ca3 Author: Phil Nash <github@philnash.me> Date: Sat Nov 10 10:20:08 2012 +0000 Changed StopOnFailure boolean to an enum commit a1dc7e312cffb0a2d241273adcae4a126d49ff15 Author: Phil Nash <github@philnash.me> Date: Tue Nov 6 19:34:35 2012 +0000 Regen single include commit 20e59ce9d133b469798c4ce2a8d681c0d9b18975 Author: Phil Nash <github@philnash.me> Date: Tue Nov 6 19:34:10 2012 +0000 Added tags docs commit b5b1b1e430c8c61dbd3162da0255a368ba9ad75f Author: Phil Nash <github@philnash.me> Date: Tue Nov 6 19:13:25 2012 +0000 Some expression/ evaluation clean-up commit ec5956f47114ff8b597be85fd7654d29da93aea0 Author: Phil Nash <github@philnash.me> Date: Tue Nov 6 07:52:28 2012 +0000 Fix for #134 The INTERNAL_CATCH_MSG macro, which is used by INFO, WARN and FAIL places its lines in a do…while block so it can be used after an if statement with no block commit 88b70828f24bbbeae636d663b14fd0117165108a Author: Phil Nash <github@philnash.me> Date: Sun Nov 4 21:39:38 2012 +0000 Regen single include commit b323fc7e6c57caa535d65cae31e6018822ed9e3c Author: Phil Nash <github@philnash.me> Date: Sun Nov 4 21:39:16 2012 +0000 Fixed line/no regression for SECTIONs Unexpected exceptions within a section now get the SECTION's line no. again (instead of TEST_CASE line/no) commit 78fba28c4b9f48ec25c9d234a29c36e4427ca6e0 Author: Phil Nash <github@philnash.me> Date: Sun Nov 4 21:11:59 2012 +0000 Added className to TestCaseInfo className is passed through from class based test methods and held in the TestCaseInfo. For free-function based test cases it is set to "global". The JUnit reporter uses the className value to populate he class attribute. commit 81cb69ef1831ed29bf770254c9112b8f0465e912 Author: Phil Nash <github@philnash.me> Date: Sun Nov 4 21:09:22 2012 +0000 AssertionInfo captures more info (for test cases and sections) commit a4e088c999439e9ec0fe3a4205b7520fbf258a5f Author: Phil Nash <github@philnash.me> Date: Fri Nov 2 08:29:03 2012 +0000 Removed __FUNCTION__ from SourceLineInfo commit 2a1e8bfc6ed3bcc1e3746d717726a9e525de6369 Author: Phil Nash <github@philnash.me> Date: Thu Nov 1 08:16:15 2012 +0000 Updated colour comments commit f0f407fc3ebdcbdad50fc1f9a45f15ab3cc54c63 Author: Phil Nash <github@philnash.me> Date: Wed Oct 31 18:28:21 2012 +0000 Manually applied merge #133 from Master commit 355b95fda1de28ba830541768aad32c7b1790290 Author: Phil Nash <github@philnash.me> Date: Wed Oct 31 18:04:22 2012 +0000 Cleaned up ANSI colour code impl a bit commit 778f9c4fc7fa66566679d9f1d8a721079d8589bf Author: Phil Nash <github@philnash.me> Date: Tue Oct 30 09:09:30 2012 +0000 Removed "no-" from Wno-global-constructors when disabling commit 5efa4bcb8a620efa13e8eb5e68d0899681919ca1 Author: Phil Nash <github@philnash.me> Date: Mon Oct 29 20:49:22 2012 +0000 Regenerated single_include commit 108f1937d8cbe04038ab8d2aaf9f6e958fe8168c Author: Phil Nash <github@philnash.me> Date: Mon Oct 29 20:46:45 2012 +0000 Added terminal colour codes for POSIX With thanks to Adam Strzelecki commit 8f4cc541d55cf55b2a67b5d6b77b5c4ceb4d99ee Author: Phil Nash <github@philnash.me> Date: Mon Oct 29 19:55:34 2012 +0000 Added regression test baselines commit 2e203a183474672e386f4cf840847cf29ccf90b9 Author: Phil Nash <github@philnash.me> Date: Mon Oct 29 19:55:13 2012 +0000 Fixed remaining reporting regressions commit 134e45b3ade922e5cbdb2df6b81830fbd93fe448 Author: Phil Nash <github@philnash.me> Date: Sun Oct 28 20:57:21 2012 +0000 Fixed #132 commit 2f92db9898978ca1ee27c964d8a51fa507391935 Author: Phil Nash <github@philnash.me> Date: Sun Oct 28 12:15:34 2012 +0000 Updated the readme specifically for the Integration branch commit 82acc2ca05459ce353de71469f141ba93e9b63cf Author: Phil Nash <github@philnash.me> Date: Sun Oct 28 12:07:17 2012 +0000 Regenerated single include commit fe1d7c1d08f06c0a83b727e9b2e00cc49e74175d Author: Phil Nash <github@philnash.me> Date: Sun Oct 28 10:27:44 2012 +0000 Small fixes and tweaks commit 355b5e546d2f64dd0abbc0134dd3579ce6c28cea Author: Phil Nash <github@philnash.me> Date: Fri Oct 26 09:05:36 2012 +0100 Some tidy-up commit f847186ebbf0e7eeabd99925574c8988add600fb Author: Phil Nash <github@philnash.me> Date: Fri Oct 26 08:45:23 2012 +0100 AssertionResultBuilder -> ExpressionResultBuilder commit 8cca2f13699aa6aa5cd4a60e293f49a1bae54629 Author: Phil Nash <github@philnash.me> Date: Wed Oct 24 22:09:01 2012 +0100 ExpressionBuilder ->ExpressionDecomposer Expression -> ExpressionLhs commit e04e74f896c714de1f03a9cc006bcd071318ea11 Author: Phil Nash <github@philnash.me> Date: Wed Oct 24 21:59:47 2012 +0100 More AssertionResult refactoring commit 1dd56d4d2b29520cdd62f5f449a28e67f954f5db Author: Phil Nash <github@philnash.me> Date: Fri Oct 19 08:01:34 2012 +0100 AssertionResultBuilder can be constructed from result type commit f2d5f1b3e444055ff02ed0536d5d0610b08ecb9f Author: Phil Nash <github@philnash.me> Date: Fri Oct 19 08:01:05 2012 +0100 Expression has its own result builder - not passed in from expression builder commit e3b111a39a4edd3bfe4d88290c99c723b8b74417 Author: Phil Nash <github@philnash.me> Date: Thu Oct 18 22:59:16 2012 +0100 streamlined acceptResult commit 3ad13256e1e50a6ee4a2697e7b6d0f669ae82ab5 Author: Phil Nash <github@philnash.me> Date: Thu Oct 18 08:39:44 2012 +0100 Refactored assertion builder stuff out of expression builder commit c96f9330a095f527673de4d8db4f434d38a7e813 Author: Phil Nash <github@philnash.me> Date: Wed Oct 17 08:14:22 2012 +0100 Collect assertion info up front commit a5fa78284d6d95770cd647a2ec10df09d378ba46 Author: Phil Nash <github@philnash.me> Date: Tue Oct 16 08:33:13 2012 +0100 ResultData -> AssertionResultData commit c597a893fa95462b8d2d5029547d4054eda1839f Author: Phil Nash <github@philnash.me> Date: Tue Oct 16 08:31:05 2012 +0100 ResultInfo -> AssertionResult filenames and variables commit d16955f63a4a128221da41602215b5592df39eb9 Author: Phil Nash <github@philnash.me> Date: Tue Oct 16 08:27:21 2012 +0100 Renamed ResultInfo -> AssertionResult commit 175da3ef6454b6fa0465d22c96d21d58dd9d2f90 Author: Phil Nash <github@philnash.me> Date: Fri Oct 12 18:39:22 2012 +0100 regen test 3
2012-11-13 22:59:50 +01:00
TestCaseStats( const std::string& className, const std::string& name )
: m_className( className ),
m_name( name )
{}
2010-12-10 09:01:42 +01:00
2011-01-31 11:10:20 +01:00
double m_timeInSeconds;
std::string m_status;
std::string m_className;
std::string m_name;
std::vector<TestStats> m_testStats;
2010-12-10 09:01:42 +01:00
};
2012-05-16 15:53:59 +02:00
struct Stats {
2010-12-10 09:01:42 +01:00
Stats( const std::string& name = std::string() )
2011-01-31 11:10:20 +01:00
: m_testsCount( 0 ),
m_failuresCount( 0 ),
m_disabledCount( 0 ),
m_errorsCount( 0 ),
m_timeInSeconds( 0 ),
m_name( name )
2012-05-16 15:53:59 +02:00
{}
2010-12-10 09:01:42 +01:00
2011-01-31 11:10:20 +01:00
std::size_t m_testsCount;
std::size_t m_failuresCount;
std::size_t m_disabledCount;
std::size_t m_errorsCount;
double m_timeInSeconds;
std::string m_name;
2010-12-10 09:01:42 +01:00
2011-01-31 11:10:20 +01:00
std::vector<TestCaseStats> m_testCaseStats;
2010-12-10 09:01:42 +01:00
};
public:
2012-07-20 20:07:42 +02:00
JunitReporter( const ReporterConfig& config )
2010-12-10 09:01:42 +01:00
: m_config( config ),
m_testSuiteStats( "AllTests" ),
m_currentStats( &m_testSuiteStats )
{}
virtual ~JunitReporter();
2010-12-10 09:01:42 +01:00
2012-05-16 15:53:59 +02:00
static std::string getDescription() {
2010-12-10 09:01:42 +01:00
return "Reports test results in an XML format that looks like Ant's junitreport target";
}
private: // IReporter
2010-12-10 09:01:42 +01:00
2012-05-16 15:53:59 +02:00
virtual bool shouldRedirectStdout() const {
return true;
}
2012-05-16 15:53:59 +02:00
virtual void StartTesting(){}
2010-12-10 09:01:42 +01:00
2012-05-16 15:53:59 +02:00
virtual void StartGroup( const std::string& groupName ) {
m_statsForSuites.push_back( Stats( groupName ) );
m_currentStats = &m_statsForSuites.back();
2010-12-10 09:01:42 +01:00
}
2012-05-16 15:53:59 +02:00
virtual void EndGroup( const std::string&, const Totals& totals ) {
m_currentStats->m_testsCount = totals.assertions.total();
2010-12-10 09:01:42 +01:00
m_currentStats = &m_testSuiteStats;
}
2012-05-16 15:53:59 +02:00
virtual void StartSection( const std::string&, const std::string& ){}
virtual void NoAssertionsInSection( const std::string& ) {}
virtual void NoAssertionsInTestCase( const std::string& ) {}
virtual void EndSection( const std::string&, const Counts& ) {}
2010-12-10 09:01:42 +01:00
2012-05-16 15:53:59 +02:00
virtual void StartTestCase( const Catch::TestCaseInfo& testInfo ) {
Squashed commit of the following: commit 70c5ef9eede41e7061ff1af45b5babe0d7cde4ba Author: Phil Nash <github@philnash.me> Date: Tue Nov 13 21:46:01 2012 +0000 Regen single include commit 4ea535e5059a664cc393404b454f29e6dad0886e Author: Phil Nash <github@philnash.me> Date: Tue Nov 13 09:56:30 2012 +0000 Tidied up result enums commit 7717c29072013fd45e36d1bc48527927fa94cbed Author: Phil Nash <github@philnash.me> Date: Tue Nov 13 09:45:29 2012 +0000 Implemented CHECK_NOFAIL Previous commit missed some files commit d539da903032e5a6f2bf40d6d7d8e7874c860088 Author: Phil Nash <github@philnash.me> Date: Tue Nov 13 09:44:52 2012 +0000 Implemented CHECK_NO_FAIL commit af1a321860a8b63fb57fcade75ba7f33cad7400c Author: Phil Nash <github@philnash.me> Date: Sat Nov 10 18:46:39 2012 +0000 Regen single include commit f54ac5625e4702e1c032f7b5a7f4d9346c64f502 Author: Phil Nash <github@philnash.me> Date: Sat Nov 10 18:44:12 2012 +0000 New (combined) baselines commit defca58566653fd088f615c2979d7e7a681bf107 Author: Phil Nash <github@philnash.me> Date: Sat Nov 10 18:43:23 2012 +0000 negate() -> endExpression(), takes ResultDisposition commit b2ef99882590ccd3824ebca44cb9b4cfc42f4728 Author: Phil Nash <github@philnash.me> Date: Sat Nov 10 10:35:09 2012 +0000 Changed shouldNegate boolean to use part of ResultDisposition enum commit 1af13dba97474c2a0b33f1ca1919c80ea4f95ca3 Author: Phil Nash <github@philnash.me> Date: Sat Nov 10 10:20:08 2012 +0000 Changed StopOnFailure boolean to an enum commit a1dc7e312cffb0a2d241273adcae4a126d49ff15 Author: Phil Nash <github@philnash.me> Date: Tue Nov 6 19:34:35 2012 +0000 Regen single include commit 20e59ce9d133b469798c4ce2a8d681c0d9b18975 Author: Phil Nash <github@philnash.me> Date: Tue Nov 6 19:34:10 2012 +0000 Added tags docs commit b5b1b1e430c8c61dbd3162da0255a368ba9ad75f Author: Phil Nash <github@philnash.me> Date: Tue Nov 6 19:13:25 2012 +0000 Some expression/ evaluation clean-up commit ec5956f47114ff8b597be85fd7654d29da93aea0 Author: Phil Nash <github@philnash.me> Date: Tue Nov 6 07:52:28 2012 +0000 Fix for #134 The INTERNAL_CATCH_MSG macro, which is used by INFO, WARN and FAIL places its lines in a do…while block so it can be used after an if statement with no block commit 88b70828f24bbbeae636d663b14fd0117165108a Author: Phil Nash <github@philnash.me> Date: Sun Nov 4 21:39:38 2012 +0000 Regen single include commit b323fc7e6c57caa535d65cae31e6018822ed9e3c Author: Phil Nash <github@philnash.me> Date: Sun Nov 4 21:39:16 2012 +0000 Fixed line/no regression for SECTIONs Unexpected exceptions within a section now get the SECTION's line no. again (instead of TEST_CASE line/no) commit 78fba28c4b9f48ec25c9d234a29c36e4427ca6e0 Author: Phil Nash <github@philnash.me> Date: Sun Nov 4 21:11:59 2012 +0000 Added className to TestCaseInfo className is passed through from class based test methods and held in the TestCaseInfo. For free-function based test cases it is set to "global". The JUnit reporter uses the className value to populate he class attribute. commit 81cb69ef1831ed29bf770254c9112b8f0465e912 Author: Phil Nash <github@philnash.me> Date: Sun Nov 4 21:09:22 2012 +0000 AssertionInfo captures more info (for test cases and sections) commit a4e088c999439e9ec0fe3a4205b7520fbf258a5f Author: Phil Nash <github@philnash.me> Date: Fri Nov 2 08:29:03 2012 +0000 Removed __FUNCTION__ from SourceLineInfo commit 2a1e8bfc6ed3bcc1e3746d717726a9e525de6369 Author: Phil Nash <github@philnash.me> Date: Thu Nov 1 08:16:15 2012 +0000 Updated colour comments commit f0f407fc3ebdcbdad50fc1f9a45f15ab3cc54c63 Author: Phil Nash <github@philnash.me> Date: Wed Oct 31 18:28:21 2012 +0000 Manually applied merge #133 from Master commit 355b95fda1de28ba830541768aad32c7b1790290 Author: Phil Nash <github@philnash.me> Date: Wed Oct 31 18:04:22 2012 +0000 Cleaned up ANSI colour code impl a bit commit 778f9c4fc7fa66566679d9f1d8a721079d8589bf Author: Phil Nash <github@philnash.me> Date: Tue Oct 30 09:09:30 2012 +0000 Removed "no-" from Wno-global-constructors when disabling commit 5efa4bcb8a620efa13e8eb5e68d0899681919ca1 Author: Phil Nash <github@philnash.me> Date: Mon Oct 29 20:49:22 2012 +0000 Regenerated single_include commit 108f1937d8cbe04038ab8d2aaf9f6e958fe8168c Author: Phil Nash <github@philnash.me> Date: Mon Oct 29 20:46:45 2012 +0000 Added terminal colour codes for POSIX With thanks to Adam Strzelecki commit 8f4cc541d55cf55b2a67b5d6b77b5c4ceb4d99ee Author: Phil Nash <github@philnash.me> Date: Mon Oct 29 19:55:34 2012 +0000 Added regression test baselines commit 2e203a183474672e386f4cf840847cf29ccf90b9 Author: Phil Nash <github@philnash.me> Date: Mon Oct 29 19:55:13 2012 +0000 Fixed remaining reporting regressions commit 134e45b3ade922e5cbdb2df6b81830fbd93fe448 Author: Phil Nash <github@philnash.me> Date: Sun Oct 28 20:57:21 2012 +0000 Fixed #132 commit 2f92db9898978ca1ee27c964d8a51fa507391935 Author: Phil Nash <github@philnash.me> Date: Sun Oct 28 12:15:34 2012 +0000 Updated the readme specifically for the Integration branch commit 82acc2ca05459ce353de71469f141ba93e9b63cf Author: Phil Nash <github@philnash.me> Date: Sun Oct 28 12:07:17 2012 +0000 Regenerated single include commit fe1d7c1d08f06c0a83b727e9b2e00cc49e74175d Author: Phil Nash <github@philnash.me> Date: Sun Oct 28 10:27:44 2012 +0000 Small fixes and tweaks commit 355b5e546d2f64dd0abbc0134dd3579ce6c28cea Author: Phil Nash <github@philnash.me> Date: Fri Oct 26 09:05:36 2012 +0100 Some tidy-up commit f847186ebbf0e7eeabd99925574c8988add600fb Author: Phil Nash <github@philnash.me> Date: Fri Oct 26 08:45:23 2012 +0100 AssertionResultBuilder -> ExpressionResultBuilder commit 8cca2f13699aa6aa5cd4a60e293f49a1bae54629 Author: Phil Nash <github@philnash.me> Date: Wed Oct 24 22:09:01 2012 +0100 ExpressionBuilder ->ExpressionDecomposer Expression -> ExpressionLhs commit e04e74f896c714de1f03a9cc006bcd071318ea11 Author: Phil Nash <github@philnash.me> Date: Wed Oct 24 21:59:47 2012 +0100 More AssertionResult refactoring commit 1dd56d4d2b29520cdd62f5f449a28e67f954f5db Author: Phil Nash <github@philnash.me> Date: Fri Oct 19 08:01:34 2012 +0100 AssertionResultBuilder can be constructed from result type commit f2d5f1b3e444055ff02ed0536d5d0610b08ecb9f Author: Phil Nash <github@philnash.me> Date: Fri Oct 19 08:01:05 2012 +0100 Expression has its own result builder - not passed in from expression builder commit e3b111a39a4edd3bfe4d88290c99c723b8b74417 Author: Phil Nash <github@philnash.me> Date: Thu Oct 18 22:59:16 2012 +0100 streamlined acceptResult commit 3ad13256e1e50a6ee4a2697e7b6d0f669ae82ab5 Author: Phil Nash <github@philnash.me> Date: Thu Oct 18 08:39:44 2012 +0100 Refactored assertion builder stuff out of expression builder commit c96f9330a095f527673de4d8db4f434d38a7e813 Author: Phil Nash <github@philnash.me> Date: Wed Oct 17 08:14:22 2012 +0100 Collect assertion info up front commit a5fa78284d6d95770cd647a2ec10df09d378ba46 Author: Phil Nash <github@philnash.me> Date: Tue Oct 16 08:33:13 2012 +0100 ResultData -> AssertionResultData commit c597a893fa95462b8d2d5029547d4054eda1839f Author: Phil Nash <github@philnash.me> Date: Tue Oct 16 08:31:05 2012 +0100 ResultInfo -> AssertionResult filenames and variables commit d16955f63a4a128221da41602215b5592df39eb9 Author: Phil Nash <github@philnash.me> Date: Tue Oct 16 08:27:21 2012 +0100 Renamed ResultInfo -> AssertionResult commit 175da3ef6454b6fa0465d22c96d21d58dd9d2f90 Author: Phil Nash <github@philnash.me> Date: Fri Oct 12 18:39:22 2012 +0100 regen test 3
2012-11-13 22:59:50 +01:00
m_currentStats->m_testCaseStats.push_back( TestCaseStats( testInfo.getClassName(), testInfo.getName() ) );
2010-12-10 09:01:42 +01:00
}
Squashed commit of the following: commit 2a1e8bfc6ed3bcc1e3746d717726a9e525de6369 Author: Phil Nash <github@philnash.me> Date: Thu Nov 1 08:16:15 2012 +0000 Updated colour comments commit f0f407fc3ebdcbdad50fc1f9a45f15ab3cc54c63 Author: Phil Nash <github@philnash.me> Date: Wed Oct 31 18:28:21 2012 +0000 Manually applied merge #133 from Master commit 355b95fda1de28ba830541768aad32c7b1790290 Author: Phil Nash <github@philnash.me> Date: Wed Oct 31 18:04:22 2012 +0000 Cleaned up ANSI colour code impl a bit commit 778f9c4fc7fa66566679d9f1d8a721079d8589bf Author: Phil Nash <github@philnash.me> Date: Tue Oct 30 09:09:30 2012 +0000 Removed "no-" from Wno-global-constructors when disabling commit 5efa4bcb8a620efa13e8eb5e68d0899681919ca1 Author: Phil Nash <github@philnash.me> Date: Mon Oct 29 20:49:22 2012 +0000 Regenerated single_include commit 108f1937d8cbe04038ab8d2aaf9f6e958fe8168c Author: Phil Nash <github@philnash.me> Date: Mon Oct 29 20:46:45 2012 +0000 Added terminal colour codes for POSIX With thanks to Adam Strzelecki commit 8f4cc541d55cf55b2a67b5d6b77b5c4ceb4d99ee Author: Phil Nash <github@philnash.me> Date: Mon Oct 29 19:55:34 2012 +0000 Added regression test baselines commit 2e203a183474672e386f4cf840847cf29ccf90b9 Author: Phil Nash <github@philnash.me> Date: Mon Oct 29 19:55:13 2012 +0000 Fixed remaining reporting regressions commit 134e45b3ade922e5cbdb2df6b81830fbd93fe448 Author: Phil Nash <github@philnash.me> Date: Sun Oct 28 20:57:21 2012 +0000 Fixed #132 commit 2f92db9898978ca1ee27c964d8a51fa507391935 Author: Phil Nash <github@philnash.me> Date: Sun Oct 28 12:15:34 2012 +0000 Updated the readme specifically for the Integration branch commit 82acc2ca05459ce353de71469f141ba93e9b63cf Author: Phil Nash <github@philnash.me> Date: Sun Oct 28 12:07:17 2012 +0000 Regenerated single include commit fe1d7c1d08f06c0a83b727e9b2e00cc49e74175d Author: Phil Nash <github@philnash.me> Date: Sun Oct 28 10:27:44 2012 +0000 Small fixes and tweaks commit 355b5e546d2f64dd0abbc0134dd3579ce6c28cea Author: Phil Nash <github@philnash.me> Date: Fri Oct 26 09:05:36 2012 +0100 Some tidy-up commit f847186ebbf0e7eeabd99925574c8988add600fb Author: Phil Nash <github@philnash.me> Date: Fri Oct 26 08:45:23 2012 +0100 AssertionResultBuilder -> ExpressionResultBuilder commit 8cca2f13699aa6aa5cd4a60e293f49a1bae54629 Author: Phil Nash <github@philnash.me> Date: Wed Oct 24 22:09:01 2012 +0100 ExpressionBuilder ->ExpressionDecomposer Expression -> ExpressionLhs commit e04e74f896c714de1f03a9cc006bcd071318ea11 Author: Phil Nash <github@philnash.me> Date: Wed Oct 24 21:59:47 2012 +0100 More AssertionResult refactoring commit 1dd56d4d2b29520cdd62f5f449a28e67f954f5db Author: Phil Nash <github@philnash.me> Date: Fri Oct 19 08:01:34 2012 +0100 AssertionResultBuilder can be constructed from result type commit f2d5f1b3e444055ff02ed0536d5d0610b08ecb9f Author: Phil Nash <github@philnash.me> Date: Fri Oct 19 08:01:05 2012 +0100 Expression has its own result builder - not passed in from expression builder commit e3b111a39a4edd3bfe4d88290c99c723b8b74417 Author: Phil Nash <github@philnash.me> Date: Thu Oct 18 22:59:16 2012 +0100 streamlined acceptResult commit 3ad13256e1e50a6ee4a2697e7b6d0f669ae82ab5 Author: Phil Nash <github@philnash.me> Date: Thu Oct 18 08:39:44 2012 +0100 Refactored assertion builder stuff out of expression builder commit c96f9330a095f527673de4d8db4f434d38a7e813 Author: Phil Nash <github@philnash.me> Date: Wed Oct 17 08:14:22 2012 +0100 Collect assertion info up front commit a5fa78284d6d95770cd647a2ec10df09d378ba46 Author: Phil Nash <github@philnash.me> Date: Tue Oct 16 08:33:13 2012 +0100 ResultData -> AssertionResultData commit c597a893fa95462b8d2d5029547d4054eda1839f Author: Phil Nash <github@philnash.me> Date: Tue Oct 16 08:31:05 2012 +0100 ResultInfo -> AssertionResult filenames and variables commit d16955f63a4a128221da41602215b5592df39eb9 Author: Phil Nash <github@philnash.me> Date: Tue Oct 16 08:27:21 2012 +0100 Renamed ResultInfo -> AssertionResult commit 175da3ef6454b6fa0465d22c96d21d58dd9d2f90 Author: Phil Nash <github@philnash.me> Date: Fri Oct 12 18:39:22 2012 +0100 regen test 3
2012-11-01 09:27:09 +01:00
virtual void Result( const Catch::AssertionResult& assertionResult ) {
if( assertionResult.getResultType() != ResultWas::Ok || m_config.includeSuccessfulResults ) {
2011-01-31 11:10:20 +01:00
TestCaseStats& testCaseStats = m_currentStats->m_testCaseStats.back();
2010-12-10 09:01:42 +01:00
TestStats stats;
std::ostringstream oss;
Squashed commit of the following: commit 2a1e8bfc6ed3bcc1e3746d717726a9e525de6369 Author: Phil Nash <github@philnash.me> Date: Thu Nov 1 08:16:15 2012 +0000 Updated colour comments commit f0f407fc3ebdcbdad50fc1f9a45f15ab3cc54c63 Author: Phil Nash <github@philnash.me> Date: Wed Oct 31 18:28:21 2012 +0000 Manually applied merge #133 from Master commit 355b95fda1de28ba830541768aad32c7b1790290 Author: Phil Nash <github@philnash.me> Date: Wed Oct 31 18:04:22 2012 +0000 Cleaned up ANSI colour code impl a bit commit 778f9c4fc7fa66566679d9f1d8a721079d8589bf Author: Phil Nash <github@philnash.me> Date: Tue Oct 30 09:09:30 2012 +0000 Removed "no-" from Wno-global-constructors when disabling commit 5efa4bcb8a620efa13e8eb5e68d0899681919ca1 Author: Phil Nash <github@philnash.me> Date: Mon Oct 29 20:49:22 2012 +0000 Regenerated single_include commit 108f1937d8cbe04038ab8d2aaf9f6e958fe8168c Author: Phil Nash <github@philnash.me> Date: Mon Oct 29 20:46:45 2012 +0000 Added terminal colour codes for POSIX With thanks to Adam Strzelecki commit 8f4cc541d55cf55b2a67b5d6b77b5c4ceb4d99ee Author: Phil Nash <github@philnash.me> Date: Mon Oct 29 19:55:34 2012 +0000 Added regression test baselines commit 2e203a183474672e386f4cf840847cf29ccf90b9 Author: Phil Nash <github@philnash.me> Date: Mon Oct 29 19:55:13 2012 +0000 Fixed remaining reporting regressions commit 134e45b3ade922e5cbdb2df6b81830fbd93fe448 Author: Phil Nash <github@philnash.me> Date: Sun Oct 28 20:57:21 2012 +0000 Fixed #132 commit 2f92db9898978ca1ee27c964d8a51fa507391935 Author: Phil Nash <github@philnash.me> Date: Sun Oct 28 12:15:34 2012 +0000 Updated the readme specifically for the Integration branch commit 82acc2ca05459ce353de71469f141ba93e9b63cf Author: Phil Nash <github@philnash.me> Date: Sun Oct 28 12:07:17 2012 +0000 Regenerated single include commit fe1d7c1d08f06c0a83b727e9b2e00cc49e74175d Author: Phil Nash <github@philnash.me> Date: Sun Oct 28 10:27:44 2012 +0000 Small fixes and tweaks commit 355b5e546d2f64dd0abbc0134dd3579ce6c28cea Author: Phil Nash <github@philnash.me> Date: Fri Oct 26 09:05:36 2012 +0100 Some tidy-up commit f847186ebbf0e7eeabd99925574c8988add600fb Author: Phil Nash <github@philnash.me> Date: Fri Oct 26 08:45:23 2012 +0100 AssertionResultBuilder -> ExpressionResultBuilder commit 8cca2f13699aa6aa5cd4a60e293f49a1bae54629 Author: Phil Nash <github@philnash.me> Date: Wed Oct 24 22:09:01 2012 +0100 ExpressionBuilder ->ExpressionDecomposer Expression -> ExpressionLhs commit e04e74f896c714de1f03a9cc006bcd071318ea11 Author: Phil Nash <github@philnash.me> Date: Wed Oct 24 21:59:47 2012 +0100 More AssertionResult refactoring commit 1dd56d4d2b29520cdd62f5f449a28e67f954f5db Author: Phil Nash <github@philnash.me> Date: Fri Oct 19 08:01:34 2012 +0100 AssertionResultBuilder can be constructed from result type commit f2d5f1b3e444055ff02ed0536d5d0610b08ecb9f Author: Phil Nash <github@philnash.me> Date: Fri Oct 19 08:01:05 2012 +0100 Expression has its own result builder - not passed in from expression builder commit e3b111a39a4edd3bfe4d88290c99c723b8b74417 Author: Phil Nash <github@philnash.me> Date: Thu Oct 18 22:59:16 2012 +0100 streamlined acceptResult commit 3ad13256e1e50a6ee4a2697e7b6d0f669ae82ab5 Author: Phil Nash <github@philnash.me> Date: Thu Oct 18 08:39:44 2012 +0100 Refactored assertion builder stuff out of expression builder commit c96f9330a095f527673de4d8db4f434d38a7e813 Author: Phil Nash <github@philnash.me> Date: Wed Oct 17 08:14:22 2012 +0100 Collect assertion info up front commit a5fa78284d6d95770cd647a2ec10df09d378ba46 Author: Phil Nash <github@philnash.me> Date: Tue Oct 16 08:33:13 2012 +0100 ResultData -> AssertionResultData commit c597a893fa95462b8d2d5029547d4054eda1839f Author: Phil Nash <github@philnash.me> Date: Tue Oct 16 08:31:05 2012 +0100 ResultInfo -> AssertionResult filenames and variables commit d16955f63a4a128221da41602215b5592df39eb9 Author: Phil Nash <github@philnash.me> Date: Tue Oct 16 08:27:21 2012 +0100 Renamed ResultInfo -> AssertionResult commit 175da3ef6454b6fa0465d22c96d21d58dd9d2f90 Author: Phil Nash <github@philnash.me> Date: Fri Oct 12 18:39:22 2012 +0100 regen test 3
2012-11-01 09:27:09 +01:00
if( !assertionResult.getMessage().empty() )
oss << assertionResult.getMessage() << " at ";
oss << assertionResult.getSourceInfo();
2011-01-31 11:10:20 +01:00
stats.m_content = oss.str();
Squashed commit of the following: commit 2a1e8bfc6ed3bcc1e3746d717726a9e525de6369 Author: Phil Nash <github@philnash.me> Date: Thu Nov 1 08:16:15 2012 +0000 Updated colour comments commit f0f407fc3ebdcbdad50fc1f9a45f15ab3cc54c63 Author: Phil Nash <github@philnash.me> Date: Wed Oct 31 18:28:21 2012 +0000 Manually applied merge #133 from Master commit 355b95fda1de28ba830541768aad32c7b1790290 Author: Phil Nash <github@philnash.me> Date: Wed Oct 31 18:04:22 2012 +0000 Cleaned up ANSI colour code impl a bit commit 778f9c4fc7fa66566679d9f1d8a721079d8589bf Author: Phil Nash <github@philnash.me> Date: Tue Oct 30 09:09:30 2012 +0000 Removed "no-" from Wno-global-constructors when disabling commit 5efa4bcb8a620efa13e8eb5e68d0899681919ca1 Author: Phil Nash <github@philnash.me> Date: Mon Oct 29 20:49:22 2012 +0000 Regenerated single_include commit 108f1937d8cbe04038ab8d2aaf9f6e958fe8168c Author: Phil Nash <github@philnash.me> Date: Mon Oct 29 20:46:45 2012 +0000 Added terminal colour codes for POSIX With thanks to Adam Strzelecki commit 8f4cc541d55cf55b2a67b5d6b77b5c4ceb4d99ee Author: Phil Nash <github@philnash.me> Date: Mon Oct 29 19:55:34 2012 +0000 Added regression test baselines commit 2e203a183474672e386f4cf840847cf29ccf90b9 Author: Phil Nash <github@philnash.me> Date: Mon Oct 29 19:55:13 2012 +0000 Fixed remaining reporting regressions commit 134e45b3ade922e5cbdb2df6b81830fbd93fe448 Author: Phil Nash <github@philnash.me> Date: Sun Oct 28 20:57:21 2012 +0000 Fixed #132 commit 2f92db9898978ca1ee27c964d8a51fa507391935 Author: Phil Nash <github@philnash.me> Date: Sun Oct 28 12:15:34 2012 +0000 Updated the readme specifically for the Integration branch commit 82acc2ca05459ce353de71469f141ba93e9b63cf Author: Phil Nash <github@philnash.me> Date: Sun Oct 28 12:07:17 2012 +0000 Regenerated single include commit fe1d7c1d08f06c0a83b727e9b2e00cc49e74175d Author: Phil Nash <github@philnash.me> Date: Sun Oct 28 10:27:44 2012 +0000 Small fixes and tweaks commit 355b5e546d2f64dd0abbc0134dd3579ce6c28cea Author: Phil Nash <github@philnash.me> Date: Fri Oct 26 09:05:36 2012 +0100 Some tidy-up commit f847186ebbf0e7eeabd99925574c8988add600fb Author: Phil Nash <github@philnash.me> Date: Fri Oct 26 08:45:23 2012 +0100 AssertionResultBuilder -> ExpressionResultBuilder commit 8cca2f13699aa6aa5cd4a60e293f49a1bae54629 Author: Phil Nash <github@philnash.me> Date: Wed Oct 24 22:09:01 2012 +0100 ExpressionBuilder ->ExpressionDecomposer Expression -> ExpressionLhs commit e04e74f896c714de1f03a9cc006bcd071318ea11 Author: Phil Nash <github@philnash.me> Date: Wed Oct 24 21:59:47 2012 +0100 More AssertionResult refactoring commit 1dd56d4d2b29520cdd62f5f449a28e67f954f5db Author: Phil Nash <github@philnash.me> Date: Fri Oct 19 08:01:34 2012 +0100 AssertionResultBuilder can be constructed from result type commit f2d5f1b3e444055ff02ed0536d5d0610b08ecb9f Author: Phil Nash <github@philnash.me> Date: Fri Oct 19 08:01:05 2012 +0100 Expression has its own result builder - not passed in from expression builder commit e3b111a39a4edd3bfe4d88290c99c723b8b74417 Author: Phil Nash <github@philnash.me> Date: Thu Oct 18 22:59:16 2012 +0100 streamlined acceptResult commit 3ad13256e1e50a6ee4a2697e7b6d0f669ae82ab5 Author: Phil Nash <github@philnash.me> Date: Thu Oct 18 08:39:44 2012 +0100 Refactored assertion builder stuff out of expression builder commit c96f9330a095f527673de4d8db4f434d38a7e813 Author: Phil Nash <github@philnash.me> Date: Wed Oct 17 08:14:22 2012 +0100 Collect assertion info up front commit a5fa78284d6d95770cd647a2ec10df09d378ba46 Author: Phil Nash <github@philnash.me> Date: Tue Oct 16 08:33:13 2012 +0100 ResultData -> AssertionResultData commit c597a893fa95462b8d2d5029547d4054eda1839f Author: Phil Nash <github@philnash.me> Date: Tue Oct 16 08:31:05 2012 +0100 ResultInfo -> AssertionResult filenames and variables commit d16955f63a4a128221da41602215b5592df39eb9 Author: Phil Nash <github@philnash.me> Date: Tue Oct 16 08:27:21 2012 +0100 Renamed ResultInfo -> AssertionResult commit 175da3ef6454b6fa0465d22c96d21d58dd9d2f90 Author: Phil Nash <github@philnash.me> Date: Fri Oct 12 18:39:22 2012 +0100 regen test 3
2012-11-01 09:27:09 +01:00
stats.m_message = assertionResult.getExpandedExpression();
stats.m_resultType = assertionResult.getTestMacroName();
2012-05-16 15:53:59 +02:00
Squashed commit of the following: commit 2a1e8bfc6ed3bcc1e3746d717726a9e525de6369 Author: Phil Nash <github@philnash.me> Date: Thu Nov 1 08:16:15 2012 +0000 Updated colour comments commit f0f407fc3ebdcbdad50fc1f9a45f15ab3cc54c63 Author: Phil Nash <github@philnash.me> Date: Wed Oct 31 18:28:21 2012 +0000 Manually applied merge #133 from Master commit 355b95fda1de28ba830541768aad32c7b1790290 Author: Phil Nash <github@philnash.me> Date: Wed Oct 31 18:04:22 2012 +0000 Cleaned up ANSI colour code impl a bit commit 778f9c4fc7fa66566679d9f1d8a721079d8589bf Author: Phil Nash <github@philnash.me> Date: Tue Oct 30 09:09:30 2012 +0000 Removed "no-" from Wno-global-constructors when disabling commit 5efa4bcb8a620efa13e8eb5e68d0899681919ca1 Author: Phil Nash <github@philnash.me> Date: Mon Oct 29 20:49:22 2012 +0000 Regenerated single_include commit 108f1937d8cbe04038ab8d2aaf9f6e958fe8168c Author: Phil Nash <github@philnash.me> Date: Mon Oct 29 20:46:45 2012 +0000 Added terminal colour codes for POSIX With thanks to Adam Strzelecki commit 8f4cc541d55cf55b2a67b5d6b77b5c4ceb4d99ee Author: Phil Nash <github@philnash.me> Date: Mon Oct 29 19:55:34 2012 +0000 Added regression test baselines commit 2e203a183474672e386f4cf840847cf29ccf90b9 Author: Phil Nash <github@philnash.me> Date: Mon Oct 29 19:55:13 2012 +0000 Fixed remaining reporting regressions commit 134e45b3ade922e5cbdb2df6b81830fbd93fe448 Author: Phil Nash <github@philnash.me> Date: Sun Oct 28 20:57:21 2012 +0000 Fixed #132 commit 2f92db9898978ca1ee27c964d8a51fa507391935 Author: Phil Nash <github@philnash.me> Date: Sun Oct 28 12:15:34 2012 +0000 Updated the readme specifically for the Integration branch commit 82acc2ca05459ce353de71469f141ba93e9b63cf Author: Phil Nash <github@philnash.me> Date: Sun Oct 28 12:07:17 2012 +0000 Regenerated single include commit fe1d7c1d08f06c0a83b727e9b2e00cc49e74175d Author: Phil Nash <github@philnash.me> Date: Sun Oct 28 10:27:44 2012 +0000 Small fixes and tweaks commit 355b5e546d2f64dd0abbc0134dd3579ce6c28cea Author: Phil Nash <github@philnash.me> Date: Fri Oct 26 09:05:36 2012 +0100 Some tidy-up commit f847186ebbf0e7eeabd99925574c8988add600fb Author: Phil Nash <github@philnash.me> Date: Fri Oct 26 08:45:23 2012 +0100 AssertionResultBuilder -> ExpressionResultBuilder commit 8cca2f13699aa6aa5cd4a60e293f49a1bae54629 Author: Phil Nash <github@philnash.me> Date: Wed Oct 24 22:09:01 2012 +0100 ExpressionBuilder ->ExpressionDecomposer Expression -> ExpressionLhs commit e04e74f896c714de1f03a9cc006bcd071318ea11 Author: Phil Nash <github@philnash.me> Date: Wed Oct 24 21:59:47 2012 +0100 More AssertionResult refactoring commit 1dd56d4d2b29520cdd62f5f449a28e67f954f5db Author: Phil Nash <github@philnash.me> Date: Fri Oct 19 08:01:34 2012 +0100 AssertionResultBuilder can be constructed from result type commit f2d5f1b3e444055ff02ed0536d5d0610b08ecb9f Author: Phil Nash <github@philnash.me> Date: Fri Oct 19 08:01:05 2012 +0100 Expression has its own result builder - not passed in from expression builder commit e3b111a39a4edd3bfe4d88290c99c723b8b74417 Author: Phil Nash <github@philnash.me> Date: Thu Oct 18 22:59:16 2012 +0100 streamlined acceptResult commit 3ad13256e1e50a6ee4a2697e7b6d0f669ae82ab5 Author: Phil Nash <github@philnash.me> Date: Thu Oct 18 08:39:44 2012 +0100 Refactored assertion builder stuff out of expression builder commit c96f9330a095f527673de4d8db4f434d38a7e813 Author: Phil Nash <github@philnash.me> Date: Wed Oct 17 08:14:22 2012 +0100 Collect assertion info up front commit a5fa78284d6d95770cd647a2ec10df09d378ba46 Author: Phil Nash <github@philnash.me> Date: Tue Oct 16 08:33:13 2012 +0100 ResultData -> AssertionResultData commit c597a893fa95462b8d2d5029547d4054eda1839f Author: Phil Nash <github@philnash.me> Date: Tue Oct 16 08:31:05 2012 +0100 ResultInfo -> AssertionResult filenames and variables commit d16955f63a4a128221da41602215b5592df39eb9 Author: Phil Nash <github@philnash.me> Date: Tue Oct 16 08:27:21 2012 +0100 Renamed ResultInfo -> AssertionResult commit 175da3ef6454b6fa0465d22c96d21d58dd9d2f90 Author: Phil Nash <github@philnash.me> Date: Fri Oct 12 18:39:22 2012 +0100 regen test 3
2012-11-01 09:27:09 +01:00
switch( assertionResult.getResultType() ) {
2010-12-10 09:01:42 +01:00
case ResultWas::ThrewException:
2011-01-31 11:10:20 +01:00
stats.m_element = "error";
m_currentStats->m_errorsCount++;
2010-12-10 09:01:42 +01:00
break;
case ResultWas::Info:
2011-01-31 11:10:20 +01:00
stats.m_element = "info"; // !TBD ?
2010-12-10 09:01:42 +01:00
break;
case ResultWas::Warning:
2011-01-31 11:10:20 +01:00
stats.m_element = "warning"; // !TBD ?
2010-12-10 09:01:42 +01:00
break;
case ResultWas::ExplicitFailure:
2011-01-31 11:10:20 +01:00
stats.m_element = "failure";
m_currentStats->m_failuresCount++;
2010-12-10 09:01:42 +01:00
break;
case ResultWas::ExpressionFailed:
2011-01-31 11:10:20 +01:00
stats.m_element = "failure";
m_currentStats->m_failuresCount++;
2010-12-10 09:01:42 +01:00
break;
case ResultWas::Ok:
2011-01-31 11:10:20 +01:00
stats.m_element = "success";
2010-12-10 09:01:42 +01:00
break;
2011-09-29 09:58:40 +02:00
case ResultWas::Unknown:
case ResultWas::FailureBit:
case ResultWas::Exception:
case ResultWas::DidntThrowException:
2010-12-10 09:01:42 +01:00
break;
}
2012-05-16 15:53:59 +02:00
testCaseStats.m_testStats.push_back( stats );
2010-12-10 09:01:42 +01:00
}
}
2012-05-16 15:53:59 +02:00
virtual void EndTestCase( const Catch::TestCaseInfo&, const Totals&, const std::string& stdOut, const std::string& stdErr ) {
2010-12-10 09:01:42 +01:00
if( !stdOut.empty() )
m_stdOut << stdOut << "\n";
if( !stdErr.empty() )
m_stdErr << stdErr << "\n";
}
virtual void Aborted() {
// !TBD
}
2012-05-16 15:53:59 +02:00
virtual void EndTesting( const Totals& ) {
2012-07-20 20:07:42 +02:00
std::ostream& str = m_config.stream;
2010-12-10 09:01:42 +01:00
{
XmlWriter xml( str );
if( m_statsForSuites.size() > 0 )
xml.startElement( "testsuites" );
std::vector<Stats>::const_iterator it = m_statsForSuites.begin();
std::vector<Stats>::const_iterator itEnd = m_statsForSuites.end();
2012-05-16 15:53:59 +02:00
for(; it != itEnd; ++it ) {
2010-12-10 09:01:42 +01:00
XmlWriter::ScopedElement e = xml.scopedElement( "testsuite" );
2011-01-31 11:10:20 +01:00
xml.writeAttribute( "name", it->m_name );
xml.writeAttribute( "errors", it->m_errorsCount );
xml.writeAttribute( "failures", it->m_failuresCount );
xml.writeAttribute( "tests", it->m_testsCount );
xml.writeAttribute( "hostname", "tbd" );
xml.writeAttribute( "time", "tbd" );
xml.writeAttribute( "timestamp", "tbd" );
2010-12-10 09:01:42 +01:00
OutputTestCases( xml, *it );
}
xml.scopedElement( "system-out" ).writeText( trim( m_stdOut.str() ) );
2012-05-24 00:59:42 +02:00
xml.scopedElement( "system-err" ).writeText( trim( m_stdErr.str() ) );
2010-12-10 09:01:42 +01:00
}
}
2012-05-16 15:53:59 +02:00
void OutputTestCases( XmlWriter& xml, const Stats& stats ) {
2011-01-31 11:10:20 +01:00
std::vector<TestCaseStats>::const_iterator it = stats.m_testCaseStats.begin();
std::vector<TestCaseStats>::const_iterator itEnd = stats.m_testCaseStats.end();
2012-05-16 15:53:59 +02:00
for(; it != itEnd; ++it ) {
2010-12-10 09:01:42 +01:00
xml.writeBlankLine();
xml.writeComment( "Test case" );
XmlWriter::ScopedElement e = xml.scopedElement( "testcase" );
2011-01-31 11:10:20 +01:00
xml.writeAttribute( "classname", it->m_className );
xml.writeAttribute( "name", it->m_name );
2010-12-10 09:01:42 +01:00
xml.writeAttribute( "time", "tbd" );
OutputTestResult( xml, *it );
}
}
2012-05-16 15:53:59 +02:00
void OutputTestResult( XmlWriter& xml, const TestCaseStats& stats ) {
2011-01-31 11:10:20 +01:00
std::vector<TestStats>::const_iterator it = stats.m_testStats.begin();
std::vector<TestStats>::const_iterator itEnd = stats.m_testStats.end();
2012-05-16 15:53:59 +02:00
for(; it != itEnd; ++it ) {
if( it->m_element != "success" ) {
2011-01-31 11:10:20 +01:00
XmlWriter::ScopedElement e = xml.scopedElement( it->m_element );
2010-12-10 09:01:42 +01:00
2011-01-31 11:10:20 +01:00
xml.writeAttribute( "message", it->m_message );
xml.writeAttribute( "type", it->m_resultType );
if( !it->m_content.empty() )
xml.writeText( it->m_content );
2010-12-10 09:01:42 +01:00
}
}
}
private:
2012-07-20 20:07:42 +02:00
ReporterConfig m_config;
2010-12-10 09:01:42 +01:00
bool m_currentTestSuccess;
Stats m_testSuiteStats;
Stats* m_currentStats;
std::vector<Stats> m_statsForSuites;
std::ostringstream m_stdOut;
std::ostringstream m_stdErr;
};
} // end namespace Catch
#endif // TWOBLUECUBES_CATCH_REPORTER_JUNIT_HPP_INCLUDED