mirror of
https://github.com/catchorg/Catch2.git
synced 2025-09-20 19:45:40 +02:00
added new timing related command line options
2 new timing related command line options have been added: - performance-timings [-p]: print out performance timings per test case and group - performance-timings-threshold [-q <secs>]: print out only the timings exceeding this given threshold value
This commit is contained in:
@@ -74,6 +74,12 @@ namespace Catch {
|
||||
Colour colour( Colour::ResultError );
|
||||
stream << "\nNo assertions in test case, '" << _testCaseStats.testInfo.name << "'\n" << std::endl;
|
||||
}
|
||||
|
||||
if( m_config->showTimings() && (_testCaseStats.timeSecs >= m_config->timingsThreshold()) ) {
|
||||
Colour colour( Colour::SecondaryText );
|
||||
stream << "Time spent in test case '" << _testCaseStats.testInfo.name << "': [timing: " << _testCaseStats.timeSecs << " secs]." << std::endl;
|
||||
}
|
||||
|
||||
StreamingReporterBase::testCaseEnded( _testCaseStats );
|
||||
m_headerPrinted = false;
|
||||
}
|
||||
@@ -84,13 +90,21 @@ namespace Catch {
|
||||
printTotals( _testGroupStats.totals );
|
||||
stream << "\n" << std::endl;
|
||||
}
|
||||
|
||||
if( m_config->showTimings() && (_testGroupStats.timeSecs >= m_config->timingsThreshold()) ) {
|
||||
Colour colour( Colour::SecondaryText );
|
||||
stream << "Time spent in test group '" << _testGroupStats.groupInfo.name << "': [timing: " << _testGroupStats.timeSecs << " secs]." << std::endl;
|
||||
}
|
||||
|
||||
StreamingReporterBase::testGroupEnded( _testGroupStats );
|
||||
}
|
||||
virtual void testRunEnded( TestRunStats const& _testRunStats ) {
|
||||
if( m_atLeastOneTestCasePrinted )
|
||||
printTotalsDivider();
|
||||
printTotals( _testRunStats.totals );
|
||||
stream << " [timing: " << _testRunStats.timeSecs << " secs.]";
|
||||
if( m_config->showTimings() ) {
|
||||
stream << " [timing: " << _testRunStats.timeSecs << " secs.]";
|
||||
}
|
||||
stream << "\n" << std::endl;
|
||||
StreamingReporterBase::testRunEnded( _testRunStats );
|
||||
}
|
||||
|
@@ -44,7 +44,7 @@ namespace Catch {
|
||||
private:
|
||||
static void OutputTestSuites( XmlWriter& xml, AccumTestRunStats const& stats ) {
|
||||
xml.startElement( "testsuites" );
|
||||
|
||||
xml.writeAttribute( "name", stats.testRun.runInfo.name );
|
||||
xml.writeAttribute( "time", stats.testRun.timeSecs );
|
||||
|
||||
std::vector<AccumTestGroupStats>::const_iterator it = stats.testGroups.begin();
|
||||
|
Reference in New Issue
Block a user