Document what QtTest's various loggers do

Provide basic (internal) documentation of each logging class and link
the command-line documentation to pages relevant to the formats not
defined by Qt.

Change-Id: I3251dd1304203c6ab87dfe1f2dec0e9787ab69f8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Edward Welbourne 2022-03-09 17:07:26 +01:00
parent 401349af26
commit 0e5c39ee13
10 changed files with 107 additions and 10 deletions

View File

@ -570,3 +570,23 @@
\externalpage https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessw
\title CreateProcess
*/
/*!
\externalpage https://testanything.org
\title Test Anything Protocol
*/
/*!
\externalpage https://www.jetbrains.com/teamcity/
\title TeamCity
*/
/*!
\externalpage https://junit.org/
\title JUnit XML
*/
/*!
\externalpage https://www.froglogic.com/testcenter/
\title Squish Test Center
*/

View File

@ -258,14 +258,14 @@
\li \c -lightxml \br
Outputs results as a stream of XML tags.
\li \c -junitxml \br
Outputs results as an JUnit XML document.
Outputs results as an \l{JUnit XML} document.
\li \c -csv \br
Outputs results as comma-separated values (CSV). This mode is only suitable for
benchmarks, since it suppresses normal pass/fail messages.
\li \c -teamcity \br
Outputs results in TeamCity format.
Outputs results in \l{TeamCity} format.
\li \c -tap \br
Outputs results in Test Anything Protocol (TAP) format.
Outputs results in \l{Test Anything Protocol} (TAP) format.
\endlist
The first version of the \c -o option may be repeated in order to log

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2021 The Qt Company Ltd.
** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtTest module of the Qt Toolkit.
@ -47,6 +47,14 @@ QT_BEGIN_NAMESPACE
using namespace QTestPrivate;
/*! \internal
\class QAppleTestLogger
\inmodule QtTest
QAppleTestLogger reports test results through Apple's unified system logging.
Results can be viewed in the Console app.
*/
bool QAppleTestLogger::debugLoggingEnabled()
{
// Debug-level messages are only captured in memory when debug logging is

View File

@ -41,6 +41,16 @@
#include "qtestresult_p.h"
#include "qbenchmark_p.h"
/*! \internal
\class QCsvBenchmarkLogger
\inmodule QtTest
QCsvBenchmarkLogger implements a comma-separated value format for benchmarks.
This is intended to be suitable for import into spreadsheets.
It does not print test failures, debug messages, warnings or any other details.
*/
QCsvBenchmarkLogger::QCsvBenchmarkLogger(const char *filename)
: QAbstractTestLogger(filename)
{

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2021 The Qt Company Ltd.
** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtTest module of the Qt Toolkit.
@ -57,6 +57,16 @@
#include <string.h>
QT_BEGIN_NAMESPACE
/*! \internal
\class QJUnitTestLogger
\inmodule QtTest
QJUnitTestLogger implements logging in a JUnit-compatible XML format.
The \l{JUnit XML} format was originally developed for Java testing.
It is supported by \l{Squish Test Center}.
*/
// QTBUG-95424 links to further useful documentation.
QJUnitTestLogger::QJUnitTestLogger(const char *filename)
: QAbstractTestLogger(filename)

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2021 The Qt Company Ltd.
** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtTest module of the Qt Toolkit.
@ -213,6 +213,15 @@ namespace QTest {
}
}
/*! \internal
\class QPlainTestLogger
\inmodule QtTest
QPlainTestLogger implements basic logging of test results.
The format is Qt-specific and aims to be be easy to read.
*/
void QPlainTestLogger::outputMessage(const char *str)
{
#if defined(Q_OS_WIN)

View File

@ -48,6 +48,17 @@
#endif
QT_BEGIN_NAMESPACE
/*! \internal
\class QTapTestLogger
\inmodule QtTest
QTapTestLogger implements the Test Anything Protocol v13.
The \l{Test Anything Protocol} (TAP) is a simple plain-text interface
between testing code and systems for reporting and analyzing test results.
\sa QAbstractTestLogger
*/
QTapTestLogger::QTapTestLogger(const char *filename)
: QAbstractTestLogger(filename)
@ -76,7 +87,7 @@ void QTapTestLogger::stopLogging()
QTestCharBuffer testPlanAndStats;
QTest::qt_asprintf(&testPlanAndStats,
"1..%d\n"
"1..%d\n" // The plan (last non-diagnostic line)
"# tests %d\n"
"# pass %d\n"
"# fail %d\n",
@ -265,4 +276,3 @@ void QTapTestLogger::addMessage(MessageTypes type, const QString &message,
}
QT_END_NAMESPACE

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2021 The Qt Company Ltd.
** Copyright (C) 2022 The Qt Company Ltd.
** Copyright (C) 2017 Borgar Ovsthus
** Contact: https://www.qt.io/licensing/
**
@ -99,6 +99,13 @@ namespace QTest {
}
}
/*! \internal
\class QTeamCityLogger
\inmodule QtTest
QTeamCityLogger implements logging in the \l{TeamCity} format.
*/
QTeamCityLogger::QTeamCityLogger(const char *filename)
: QAbstractTestLogger(filename)
{

View File

@ -46,6 +46,9 @@
#import <XCTest/XCTest.h>
// This XCode logging integration has probably bit-rotted since it was written.
// It is not even compiled as part of normal builds.
// ---------------------------------------------------------
@interface XCTestProbe (Private)

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2021 The Qt Company Ltd.
** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtTest module of the Qt Toolkit.
@ -101,6 +101,26 @@ namespace QTest {
}
/*! \internal
\class QXmlTestLogger
\inmodule QtTest
QXmlTestLogger implements two XML formats specific to Qt.
The two formats are distinguished by the XmlMode enum.
*/
/*! \internal
\enum QXmlTestLogger::XmlMode
This enumerated type selects the type of XML output to produce.
\value Complete A full self-contained XML document
\value Light XML content suitable for embedding in an XML document
The Complete form wraps the Light form in a <TestCase> element whose name
attribute identifies the test class whose private slots are to be run. It
also includes the usual <?xml ...> preamble.
*/
QXmlTestLogger::QXmlTestLogger(XmlMode mode, const char *filename)
: QAbstractTestLogger(filename), xmlmode(mode)