mirror of
https://github.com/catchorg/Catch2.git
synced 2024-12-23 11:43:29 +01:00
junit reporter does not count exceptions as failures if ok-to-fail
This commit is contained in:
parent
2bf30e9e5a
commit
e5c5a636a9
@ -51,7 +51,8 @@ namespace Catch {
|
|||||||
public:
|
public:
|
||||||
JunitReporter( ReporterConfig const& _config )
|
JunitReporter( ReporterConfig const& _config )
|
||||||
: CumulativeReporterBase( _config ),
|
: CumulativeReporterBase( _config ),
|
||||||
xml( _config.stream() )
|
xml( _config.stream() ),
|
||||||
|
m_okToFail( false )
|
||||||
{
|
{
|
||||||
m_reporterPrefs.shouldRedirectStdOut = true;
|
m_reporterPrefs.shouldRedirectStdOut = true;
|
||||||
}
|
}
|
||||||
@ -77,8 +78,11 @@ namespace Catch {
|
|||||||
CumulativeReporterBase::testGroupStarting( groupInfo );
|
CumulativeReporterBase::testGroupStarting( groupInfo );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void testCaseStarting( TestCaseInfo const& testCaseInfo ) CATCH_OVERRIDE {
|
||||||
|
m_okToFail = testCaseInfo.okToFail();
|
||||||
|
}
|
||||||
virtual bool assertionEnded( AssertionStats const& assertionStats ) CATCH_OVERRIDE {
|
virtual bool assertionEnded( AssertionStats const& assertionStats ) CATCH_OVERRIDE {
|
||||||
if( assertionStats.assertionResult.getResultType() == ResultWas::ThrewException )
|
if( assertionStats.assertionResult.getResultType() == ResultWas::ThrewException && !m_okToFail )
|
||||||
unexpectedExceptions++;
|
unexpectedExceptions++;
|
||||||
return CumulativeReporterBase::assertionEnded( assertionStats );
|
return CumulativeReporterBase::assertionEnded( assertionStats );
|
||||||
}
|
}
|
||||||
@ -243,6 +247,7 @@ namespace Catch {
|
|||||||
std::ostringstream stdOutForSuite;
|
std::ostringstream stdOutForSuite;
|
||||||
std::ostringstream stdErrForSuite;
|
std::ostringstream stdErrForSuite;
|
||||||
unsigned int unexpectedExceptions;
|
unsigned int unexpectedExceptions;
|
||||||
|
bool m_okToFail;
|
||||||
};
|
};
|
||||||
|
|
||||||
INTERNAL_CATCH_REGISTER_REPORTER( "junit", JunitReporter )
|
INTERNAL_CATCH_REGISTER_REPORTER( "junit", JunitReporter )
|
||||||
|
Loading…
Reference in New Issue
Block a user