Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QTestLog Class Reference

#include <qtestlog_p.h>

+ Collaboration diagram for QTestLog:

Public Types

enum  LogMode {
  Plain = 0 , XML , LightXML , JUnitXML ,
  CSV , TeamCity , TAP
}
 

Public Member Functions

 QTestLog ()=delete
 
 ~QTestLog ()=delete
 
 Q_ENUM (LogMode)
 

Static Public Member Functions

static void enterTestFunction (const char *function)
 
static void leaveTestFunction ()
 
static void enterTestData (QTestData *data)
 
static void addPass (const char *msg)
 
static void addFail (const char *msg, const char *file, int line)
 
static void addXFail (const char *msg, const char *file, int line)
 
static void addXPass (const char *msg, const char *file, int line)
 
static void addBPass (const char *msg)
 
static void addBFail (const char *msg, const char *file, int line)
 
static void addBXPass (const char *msg, const char *file, int line)
 
static void addBXFail (const char *msg, const char *file, int line)
 
static void addSkip (const char *msg, const char *file, int line)
 
static void addBenchmarkResult (const QList< QBenchmarkResult > &result)
 
static void addBenchmarkResults (const QList< QBenchmarkResult > &result)
 
static void ignoreMessage (QtMsgType type, const char *msg)
 
static void ignoreMessage (QtMsgType type, const QRegularExpression &expression)
 
static void failOnWarning ()
 
static void failOnWarning (const char *msg)
 
static void failOnWarning (const QRegularExpression &expression)
 
static int unhandledIgnoreMessages ()
 
static void printUnhandledIgnoreMessages ()
 
static void clearIgnoreMessages ()
 
static void clearFailOnWarnings ()
 
static void clearCurrentTestState ()
 
static void warn (const char *msg, const char *file, int line)
 
static void info (const char *msg, const char *file, int line)
 
static void startLogging ()
 
static void stopLogging ()
 
static void addLogger (LogMode mode, const char *filename)
 
static void addLogger (QAbstractTestLogger *logger)
 
static bool hasLoggers ()
 
static bool isRepeatSupported ()
 
static bool loggerUsingStdout ()
 
static void setVerboseLevel (int level)
 
static int verboseLevel ()
 
static void setMaxWarnings (int max)
 
static void setPrintAvailableTagsMode ()
 
static int passCount ()
 
static int failCount ()
 
static int skipCount ()
 
static int blacklistCount ()
 
static int totalCount ()
 
static void resetCounters ()
 
static void setInstalledTestCoverage (bool installed)
 
static bool installedTestCoverage ()
 
static qint64 nsecsTotalTime ()
 
static qreal msecsTotalTime ()
 
static qint64 nsecsFunctionTime ()
 
static qreal msecsFunctionTime ()
 

Related Symbols

(Note that these are not member symbols.)

 failOnWarning
 
 failOnWarning
 

Detailed Description

Definition at line 33 of file qtestlog_p.h.

Member Enumeration Documentation

◆ LogMode

Enumerator
Plain 
XML 
LightXML 
JUnitXML 
CSV 
TeamCity 
TAP 

Definition at line 41 of file qtestlog_p.h.

Constructor & Destructor Documentation

◆ QTestLog()

QTestLog::QTestLog ( )
delete

◆ ~QTestLog()

QTestLog::~QTestLog ( )
delete

Member Function Documentation

◆ addBenchmarkResult()

static void QTestLog::addBenchmarkResult ( const QList< QBenchmarkResult > & result)
inlinestatic

Definition at line 66 of file qtestlog_p.h.

◆ addBenchmarkResults()

void QTestLog::addBenchmarkResults ( const QList< QBenchmarkResult > & result)
static

Definition at line 475 of file qtestlog.cpp.

References FOREACH_TEST_LOGGER, and results.

Referenced by QuickTestResult::needsMoreMeasurements().

+ Here is the caller graph for this function:

◆ addBFail()

void QTestLog::addBFail ( const char * msg,
const char * file,
int line )
static

Definition at line 408 of file qtestlog.cpp.

References QAbstractTestLogger::BlacklistedFail, QTest::blacklists, QTest::currentTestState, file, FOREACH_TEST_LOGGER, line, Q_ASSERT, QTEST_ASSERT, QTest::Skipped, QTest::Suppressed, and QTest::Unresolved.

Referenced by QTestResult::addFailure().

+ Here is the caller graph for this function:

◆ addBPass()

void QTestLog::addBPass ( const char * msg)
static

Definition at line 396 of file qtestlog.cpp.

References QAbstractTestLogger::BlacklistedPass, QTest::blacklists, QTest::currentTestState, FOREACH_TEST_LOGGER, Q_ASSERT, QTEST_ASSERT, QTest::Suppressed, and QTest::Unresolved.

Referenced by QTestResult::finishedCurrentTestDataCleanup().

+ Here is the caller graph for this function:

◆ addBXFail()

void QTestLog::addBXFail ( const char * msg,
const char * file,
int line )
static

Definition at line 444 of file qtestlog.cpp.

References QAbstractTestLogger::BlacklistedXFail, file, FOREACH_TEST_LOGGER, line, and QTEST_ASSERT.

Referenced by checkStatement().

+ Here is the caller graph for this function:

◆ addBXPass()

void QTestLog::addBXPass ( const char * msg,
const char * file,
int line )
static

Definition at line 426 of file qtestlog.cpp.

References QAbstractTestLogger::BlacklistedXPass, QTest::blacklists, QTest::currentTestState, file, FOREACH_TEST_LOGGER, line, Q_ASSERT, QTEST_ASSERT, QTest::Skipped, QTest::Suppressed, and QTest::Unresolved.

Referenced by checkStatement().

+ Here is the caller graph for this function:

◆ addFail()

void QTestLog::addFail ( const char * msg,
const char * file,
int line )
static

Definition at line 348 of file qtestlog.cpp.

References QTest::currentTestState, QAbstractTestLogger::Fail, QTest::Failed, QTest::fails, file, FOREACH_TEST_LOGGER, line, Q_ASSERT, QTEST_ASSERT, QTest::Skipped, and QTest::Unresolved.

Referenced by QTestResult::addFailure().

+ Here is the caller graph for this function:

◆ addLogger() [1/2]

void QTestLog::addLogger ( LogMode mode,
const char * filename )
static

Definition at line 500 of file qtestlog.cpp.

References addLogger(), QXmlTestLogger::Complete, CSV, JUnitXML, QXmlTestLogger::Light, LightXML, Plain, QTEST_ASSERT, TAP, TeamCity, and XML.

Referenced by addLogger(), and QTest::qtest_qParseArgs().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addLogger() [2/2]

void QTestLog::addLogger ( QAbstractTestLogger * logger)
static

Adds a new logger to the set of loggers that will be used to report incidents and messages during testing.

The function takes ownership of the logger.

Definition at line 552 of file qtestlog.cpp.

References QTEST_ASSERT.

◆ addPass()

void QTestLog::addPass ( const char * msg)
static

Definition at line 333 of file qtestlog.cpp.

References QTest::currentTestState, FOREACH_TEST_LOGGER, QAbstractTestLogger::Pass, QTest::Passed, QTest::passes, Q_ASSERT, QTEST_ASSERT, and QTest::Unresolved.

Referenced by QTestResult::finishedCurrentTestDataCleanup().

+ Here is the caller graph for this function:

◆ addSkip()

void QTestLog::addSkip ( const char * msg,
const char * file,
int line )
static

Definition at line 454 of file qtestlog.cpp.

References QTest::currentTestState, QTest::Failed, file, FOREACH_TEST_LOGGER, line, Q_ASSERT, QTEST_ASSERT, QAbstractTestLogger::Skip, QTest::Skipped, QTest::skips, QTest::Suppressed, and QTest::Unresolved.

Referenced by QTestResult::addSkip().

+ Here is the caller graph for this function:

◆ addXFail()

void QTestLog::addXFail ( const char * msg,
const char * file,
int line )
static

Definition at line 368 of file qtestlog.cpp.

References file, FOREACH_TEST_LOGGER, line, QTEST_ASSERT, and QAbstractTestLogger::XFail.

Referenced by checkStatement().

+ Here is the caller graph for this function:

◆ addXPass()

void QTestLog::addXPass ( const char * msg,
const char * file,
int line )
static

Definition at line 378 of file qtestlog.cpp.

References QTest::currentTestState, QTest::Failed, QTest::fails, file, FOREACH_TEST_LOGGER, line, Q_ASSERT, QTEST_ASSERT, QTest::Skipped, QTest::Unresolved, and QAbstractTestLogger::XPass.

Referenced by checkStatement().

+ Here is the caller graph for this function:

◆ blacklistCount()

int QTestLog::blacklistCount ( )
static

Definition at line 678 of file qtestlog.cpp.

References QTest::blacklists.

Referenced by QPlainTestLogger::stopLogging(), and totalCount().

+ Here is the caller graph for this function:

◆ clearCurrentTestState()

void QTestLog::clearCurrentTestState ( )
static

Definition at line 326 of file qtestlog.cpp.

References clearFailOnWarnings(), clearIgnoreMessages(), QTest::currentTestState, and QTest::Unresolved.

Referenced by QTestResult::finishedCurrentTestDataCleanup(), and QTestResult::finishedCurrentTestFunction().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clearFailOnWarnings()

void QTestLog::clearFailOnWarnings ( )
static

Definition at line 321 of file qtestlog.cpp.

References QTest::failOnWarningList.

Referenced by clearCurrentTestState().

+ Here is the caller graph for this function:

◆ clearIgnoreMessages()

void QTestLog::clearIgnoreMessages ( )
static

Definition at line 315 of file qtestlog.cpp.

References QTest::IgnoreResultList::clearList(), QTest::ignoreResultList, and QTest::mutex.

Referenced by clearCurrentTestState().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ enterTestData()

void QTestLog::enterTestData ( QTestData * data)
static

Definition at line 265 of file qtestlog.cpp.

References FOREACH_TEST_LOGGER, and QTEST_ASSERT.

Referenced by QTestResult::setCurrentTestData().

+ Here is the caller graph for this function:

◆ enterTestFunction()

void QTestLog::enterTestFunction ( const char * function)
static

Definition at line 253 of file qtestlog.cpp.

References elapsedFunctionTime, FOREACH_TEST_LOGGER, and QTEST_ASSERT.

Referenced by QTestResult::setCurrentTestFunction().

+ Here is the caller graph for this function:

◆ failCount()

int QTestLog::failCount ( )
static

Definition at line 668 of file qtestlog.cpp.

References QTest::fails.

Referenced by QuickTestResult::exitCode(), QuickTestResult::failCount(), QTest::qRun(), saveCoverageTool(), stopLogging(), QPlainTestLogger::stopLogging(), QTapTestLogger::stopLogging(), and totalCount().

+ Here is the caller graph for this function:

◆ failOnWarning() [1/3]

void QTestLog::failOnWarning ( )
static

Definition at line 632 of file qtestlog.cpp.

References QTest::failOnWarningList.

Referenced by QTest::failOnWarning(), and QTest::failOnWarning().

+ Here is the caller graph for this function:

◆ failOnWarning() [2/3]

void QTestLog::failOnWarning ( const char * msg)
static

Definition at line 637 of file qtestlog.cpp.

References QTest::failOnWarningList, and QString::fromUtf8().

+ Here is the call graph for this function:

◆ failOnWarning() [3/3]

static void QTestLog::failOnWarning ( const QRegularExpression & expression)
static

◆ hasLoggers()

bool QTestLog::hasLoggers ( )
static

Definition at line 558 of file qtestlog.cpp.

Referenced by QTest::messageHandler(), and QTest::qtest_qParseArgs().

+ Here is the caller graph for this function:

◆ ignoreMessage() [1/2]

void QTestLog::ignoreMessage ( QtMsgType type,
const char * msg )
static

Definition at line 614 of file qtestlog.cpp.

References QTest::IgnoreResultList::append(), QString::fromUtf8(), QTest::ignoreResultList, QTest::mutex, and QTEST_ASSERT.

Referenced by QTest::ignoreMessage(), and QuickTestResult::ignoreWarning().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ignoreMessage() [2/2]

static void QTestLog::ignoreMessage ( QtMsgType type,
const QRegularExpression & expression )
static

◆ info()

void QTestLog::info ( const char * msg,
const char * file,
int line )
static

Definition at line 596 of file qtestlog.cpp.

References file, FOREACH_TEST_LOGGER, QString::fromUtf8(), QAbstractTestLogger::Info, line, and QTEST_ASSERT.

Referenced by compareHelper(), compareHelper(), QTest::qFindTestData(), QTest::qPrintMessage(), QTestResult::reportResult(), and QTestResult::verify().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ installedTestCoverage()

bool QTestLog::installedTestCoverage ( )
static

Definition at line 700 of file qtestlog.cpp.

References QTest::installedTestCoverage.

Referenced by stopLogging().

+ Here is the caller graph for this function:

◆ isRepeatSupported()

bool QTestLog::isRepeatSupported ( )
static

Returns true if all loggers support repeated test runs

Definition at line 568 of file qtestlog.cpp.

References FOREACH_TEST_LOGGER.

Referenced by QTest::qtest_qParseArgs().

+ Here is the caller graph for this function:

◆ leaveTestFunction()

void QTestLog::leaveTestFunction ( )
static

Definition at line 285 of file qtestlog.cpp.

References FOREACH_TEST_LOGGER.

Referenced by QTestResult::finishedCurrentTestFunction(), and QTest::messageHandler().

+ Here is the caller graph for this function:

◆ loggerUsingStdout()

bool QTestLog::loggerUsingStdout ( )
static

Definition at line 578 of file qtestlog.cpp.

References FOREACH_TEST_LOGGER.

Referenced by QTest::qtest_qParseArgs().

+ Here is the caller graph for this function:

◆ msecsFunctionTime()

static qreal QTestLog::msecsFunctionTime ( )
inlinestatic

Definition at line 119 of file qtestlog_p.h.

References nsecsFunctionTime().

Referenced by QXmlTestLogger::leaveTestFunction(), and QTest::CrashHandler::printTestRunTime().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ msecsTotalTime()

static qreal QTestLog::msecsTotalTime ( )
inlinestatic

Definition at line 117 of file qtestlog_p.h.

References nsecsTotalTime().

Referenced by QTest::CrashHandler::printTestRunTime(), QJUnitTestLogger::stopLogging(), QPlainTestLogger::stopLogging(), and QXmlTestLogger::stopLogging().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nsecsFunctionTime()

qint64 QTestLog::nsecsFunctionTime ( )
static

Definition at line 710 of file qtestlog.cpp.

References elapsedFunctionTime.

Referenced by msecsFunctionTime().

+ Here is the caller graph for this function:

◆ nsecsTotalTime()

qint64 QTestLog::nsecsTotalTime ( )
static

Definition at line 705 of file qtestlog.cpp.

References elapsedTotalTime.

Referenced by msecsTotalTime().

+ Here is the caller graph for this function:

◆ passCount()

int QTestLog::passCount ( )
static

Definition at line 663 of file qtestlog.cpp.

References QTest::passes.

Referenced by QuickTestResult::passCount(), saveCoverageTool(), QPlainTestLogger::stopLogging(), QTapTestLogger::stopLogging(), and totalCount().

+ Here is the caller graph for this function:

◆ printUnhandledIgnoreMessages()

void QTestLog::printUnhandledIgnoreMessages ( )
static

Definition at line 294 of file qtestlog.cpp.

References FOREACH_TEST_LOGGER, QTest::ignoreResultList, QAbstractTestLogger::Info, list, and QTest::mutex.

Referenced by QTestResult::finishedCurrentTestDataCleanup().

+ Here is the caller graph for this function:

◆ Q_ENUM()

QTestLog::Q_ENUM ( LogMode )

◆ resetCounters()

void QTestLog::resetCounters ( )
static

Definition at line 688 of file qtestlog.cpp.

References QTest::fails, QTest::passes, and QTest::skips.

Referenced by QTestResult::reset().

+ Here is the caller graph for this function:

◆ setInstalledTestCoverage()

void QTestLog::setInstalledTestCoverage ( bool installed)
static

Definition at line 695 of file qtestlog.cpp.

References QTest::installedTestCoverage.

Referenced by QTest::qtest_qParseArgs().

+ Here is the caller graph for this function:

◆ setMaxWarnings()

void QTestLog::setMaxWarnings ( int max)
static

Definition at line 651 of file qtestlog.cpp.

References QTest::maxWarnings.

Referenced by QTest::qtest_qParseArgs().

+ Here is the caller graph for this function:

◆ setPrintAvailableTagsMode()

void QTestLog::setPrintAvailableTagsMode ( )
static

Definition at line 658 of file qtestlog.cpp.

Referenced by QTest::qPrintDataTags().

+ Here is the caller graph for this function:

◆ setVerboseLevel()

void QTestLog::setVerboseLevel ( int level)
static

Definition at line 604 of file qtestlog.cpp.

References QTest::verbosity.

Referenced by QTest::qtest_qParseArgs().

+ Here is the caller graph for this function:

◆ skipCount()

int QTestLog::skipCount ( )
static

Definition at line 673 of file qtestlog.cpp.

References QTest::skips.

Referenced by QuickTestResult::skipCount(), QJUnitTestLogger::stopLogging(), QPlainTestLogger::stopLogging(), and totalCount().

+ Here is the caller graph for this function:

◆ startLogging()

void QTestLog::startLogging ( )
static

Definition at line 481 of file qtestlog.cpp.

References elapsedFunctionTime, elapsedTotalTime, FOREACH_TEST_LOGGER, QTest::messageHandler(), QTest::oldMessageHandler, and qInstallMessageHandler().

Referenced by QTest::qInit(), and QuickTestResult::startLogging().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ stopLogging()

void QTestLog::stopLogging ( )
static

Definition at line 490 of file qtestlog.cpp.

References QTestResult::currentAppName(), failCount(), FOREACH_TEST_LOGGER, installedTestCoverage(), QTest::oldMessageHandler, qInstallMessageHandler(), and saveCoverageTool().

Referenced by QTest::messageHandler(), QTest::qCleanup(), QuickTestResult::setProgramName(), and QuickTestResult::stopLogging().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ totalCount()

int QTestLog::totalCount ( )
static

Definition at line 683 of file qtestlog.cpp.

References blacklistCount(), failCount(), passCount(), and skipCount().

Referenced by QTapTestLogger::addIncident(), and QTapTestLogger::stopLogging().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unhandledIgnoreMessages()

int QTestLog::unhandledIgnoreMessages ( )
static

Definition at line 273 of file qtestlog.cpp.

References i, QTest::ignoreResultList, list, and QTest::mutex.

Referenced by QTestResult::finishedCurrentTestDataCleanup().

+ Here is the caller graph for this function:

◆ verboseLevel()

int QTestLog::verboseLevel ( )
static

◆ warn()

void QTestLog::warn ( const char * msg,
const char * file,
int line )
static

Definition at line 588 of file qtestlog.cpp.

References file, FOREACH_TEST_LOGGER, QString::fromUtf8(), line, QTEST_ASSERT, and QAbstractTestLogger::Warn.

Referenced by QTest::qFindTestData(), and QuickTestResult::warn().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ failOnWarning() [1/2]

failOnWarning ( )
related

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Since
6.8

Appends a test failure to the test log if any warning is output.

See also
failOnWarning()

◆ failOnWarning() [2/2]

failOnWarning ( )
related

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Since
6.3

Appends a test failure to the test log if the message is output.

See also
failOnWarning()

The documentation for this class was generated from the following files: