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

summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorPhil Nash2014-12-19 19:05:24 +0000
committerPhil Nash2014-12-19 19:05:24 +0000
commit7306eb3cfcf36b8f4d8ff478a25be358b1651ef0 (patch)
tree286215bb9a59d2e8f9a458e3f508984cf7050628 /include
parent458b3ae257d46cecd8bc555a9ea59284997f12e4 (diff)
downloadcatch3-7306eb3cfcf36b8f4d8ff478a25be358b1651ef0.tar.gz
TeamCity reporter
added more detail to the assertion message
Diffstat (limited to 'include')
-rw-r--r--include/reporters/catch_reporter_teamcity.hpp56
1 files changed, 53 insertions, 3 deletions
diff --git a/include/reporters/catch_reporter_teamcity.hpp b/include/reporters/catch_reporter_teamcity.hpp
index 2de57d6a..16215e7a 100644
--- a/include/reporters/catch_reporter_teamcity.hpp
+++ b/include/reporters/catch_reporter_teamcity.hpp
@@ -62,11 +62,61 @@ namespace Catch {
}
virtual bool assertionEnded( AssertionStats const& assertionStats ) {
- if( !assertionStats.assertionResult.isOk() ) {
+ AssertionResult const& result = assertionStats.assertionResult;
+ if( !result.isOk() ) {
+
+ std::string message;
+ switch( result.getResultType() ) {
+ case ResultWas::ExpressionFailed:
+ message = "expression failed";
+ break;
+ case ResultWas::ThrewException:
+ message = "unexpected exception with message";
+ break;
+ case ResultWas::FatalErrorCondition:
+ message = "fatal error condition";
+ break;
+ case ResultWas::DidntThrowException:
+ message = "no exception was thrown where one was expected";
+ break;
+ case ResultWas::ExplicitFailure:
+ message = "explicit failure";
+ break;
+
+ // We shouldn't get here because of the isOk() test
+ case ResultWas::Ok:
+ case ResultWas::Info:
+ case ResultWas::Warning:
+
+ // These cases are here to prevent compiler warnings
+ case ResultWas::Unknown:
+ case ResultWas::FailureBit:
+ case ResultWas::Exception:
+ CATCH_NOT_IMPLEMENTED;
+ }
+ if( assertionStats.infoMessages.size() == 1 )
+ message += " with message:";
+ if( assertionStats.infoMessages.size() > 1 )
+ message += " with messages:";
+ for( std::vector<MessageInfo>::const_iterator
+ it = assertionStats.infoMessages.begin(),
+ itEnd = assertionStats.infoMessages.end();
+ it != itEnd;
+ ++it )
+ message += "\n" + it->message;
+
+
+ std::string details =
+ " " + result.getExpressionInMacro() + "\n" +
+ "with expansion:\n" +
+ " " + result.getExpandedExpression() + "\n";
+
+ // !TBD: file/ line
+
stream << "##teamcity[testFailed"
<< " name='" << escape( currentTestCaseInfo->name )<< "'"
- << " message='message here'" // !TBD
- << " details='details?'" // !TBD
+ << " message='" << escape( message ) << "'"
+ << " details='" << escape( details ) << "'"
<< "]\n";
}
return true;