tests/gtest/teamcity/src/teamcity_gtest.cpp
// Fired after the test ends.
Fired after the test ends.
Fired after the test ends .
void TeamcityGoogleTestEventListener::OnTestEnd(const TestInfo& test_info) {
    const TestResult* result = test_info.result();
    if (result->Failed()) {
        std::string message;
        std::string details;
        for (int i = 0; i < result->total_part_count(); ++i) {
            const TestPartResult& partResult = result->GetTestPartResult(i);
            if (partResult.passed()) {
                continue;
            }
            if (message.empty()) {
                message = partResult.summary();
            }
            if (!details.empty()) {
                details.append("\n");
            }
            details.append(partResult.message());
            if (partResult.file_name() && partResult.line_number() >= 0) {
                std::stringstream ss;
                ss << "\n at " << partResult.file_name() << ":" << partResult.line_number();
                details.append(ss.str());
            }
        }
        messages.testFailed(
            test_info.name(),
            !message.empty() ? message : "failed",
            details,
            flowid
        );
    }
    messages.testFinished(test_info.name(), static_cast<int>(result->elapsed_time()), flowid);
}
void TeamcityGoogleTestEventListener :: OnTestEnd ( const TestInfo & test_info ) { const TestResult * result = test_info . result ( ) ; if ( result -> Failed ( ) ) { std :: string message ; std :: string details ; for ( int i = 0 ; i < result -> total_part_count ( ) ; ++ i ) { const TestPartResult & partResult = result -> GetTestPartResult ( i ) ; if ( partResult . passed ( ) ) { continue ; } if ( message . empty ( ) ) { message = partResult . summary ( ) ; } if ( ! details . empty ( ) ) { details . append ( " \n " ) ; } details . append ( partResult . message ( ) ) ; if ( partResult . file_name ( ) && partResult . line_number ( ) >= 0 ) { std :: stringstream ss ; ss << " \n " << partResult . file_name ( ) << " " << partResult . line_number ( ) ; details . append ( ss . str ( ) ) ; } } messages . testFailed ( test_info . name ( ) , ! message . empty ( ) ? message : " " , details , flowid ) ; } messages . testFinished ( test_info . name ( ) , static_cast < int > ( result -> elapsed_time ( ) ) , flowid ) ; }
Fired after the test ends.
Fired after the test ends .