Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qjunittestlogger_p.h
Go to the documentation of this file.
1
// Copyright (C) 2016 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4
#
ifndef
QJUNITTESTLOGGER_P_H
5
#
define
QJUNITTESTLOGGER_P_H
6
7
//
8
// W A R N I N G
9
// -------------
10
//
11
// This file is not part of the Qt API. It exists purely as an
12
// implementation detail. This header file may change from version to
13
// version without notice, or even be removed.
14
//
15
// We mean it.
16
//
17
18
#
include
<
QtTest
/
qttestglobal
.
h
>
19
20
#
include
<
QtTest
/
private
/
qabstracttestlogger_p
.
h
>
21
#
include
<
QtTest
/
private
/
qtestelementattribute_p
.
h
>
22
#
include
<
QtCore
/
qmutex
.
h
>
23
24
#
include
<
vector
>
25
26
QT_BEGIN_NAMESPACE
27
28
class
QTestJUnitStreamer;
29
class
QTestElement;
30
31
class
QJUnitTestLogger
:
public
QAbstractTestLogger
32
{
33
public
:
34
QJUnitTestLogger
(
const
char
*filename);
35
~
QJUnitTestLogger
();
36
37
void
startLogging
()
override
;
38
void
stopLogging
()
override
;
39
40
void
enterTestFunction
(
const
char
*function)
override
;
41
void
leaveTestFunction
()
override
;
42
43
void
enterTestData
(QTestData *)
override
;
44
45
void
addIncident
(IncidentTypes type,
const
char
*description,
46
const
char
*file =
nullptr
,
int
line = 0)
override
;
47
void
addMessage
(MessageTypes type,
const
QString &message,
48
const
char
*file =
nullptr
,
int
line = 0)
override
;
49
50
void
addBenchmarkResult
(
const
QBenchmarkResult &)
override
{}
51
52
private
:
53
void
enterTestCase(
const
char
*name);
54
void
leaveTestCase();
55
56
void
addFailure(QTest::LogElementType elementType,
57
const
char
*failureType,
const
QString &failureDescription);
58
59
QTestElement *currentTestSuite =
nullptr
;
60
std::vector<QTestElement*> listOfTestcases;
61
QTestElement *currentTestCase =
nullptr
;
62
QTestElement *systemOutputElement =
nullptr
;
63
QTestElement *systemErrorElement =
nullptr
;
64
QTestJUnitStreamer
*logFormatter =
nullptr
;
65
// protects currentTestCase, systemOutputElement and systemErrorElement
66
// in case of qDebug()/qWarning() etc. from threads
67
QMutex mutex;
68
69
int
testCounter = 0;
70
int
failureCounter = 0;
71
int
errorCounter = 0;
72
};
73
74
QT_END_NAMESPACE
75
76
#
endif
// QJUNITTESTLOGGER_P_H
QJUnitTestLogger
Definition
qjunittestlogger_p.h:32
QJUnitTestLogger::stopLogging
void stopLogging() override
Called after the end of a test run.
Definition
qjunittestlogger.cpp:95
QJUnitTestLogger::enterTestFunction
void enterTestFunction(const char *function) override
This virtual method is called before each test function is invoked.
Definition
qjunittestlogger.cpp:126
QJUnitTestLogger::startLogging
void startLogging() override
Called before the start of a test run.
Definition
qjunittestlogger.cpp:55
QJUnitTestLogger::addMessage
void addMessage(MessageTypes type, const QString &message, const char *file=nullptr, int line=0) override
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition
qjunittestlogger.cpp:259
QJUnitTestLogger::enterTestData
void enterTestData(QTestData *) override
This virtual method is called before and after each call to a test function.
Definition
qjunittestlogger.cpp:152
QJUnitTestLogger::addIncident
void addIncident(IncidentTypes type, const char *description, const char *file=nullptr, int line=0) override
This virtual method is called when an event occurs that relates to the resolution of the test.
Definition
qjunittestlogger.cpp:198
QJUnitTestLogger::~QJUnitTestLogger
~QJUnitTestLogger()
Definition
qjunittestlogger.cpp:36
QJUnitTestLogger::QJUnitTestLogger
QJUnitTestLogger(const char *filename)
Definition
qjunittestlogger.cpp:31
QJUnitTestLogger::addBenchmarkResult
void addBenchmarkResult(const QBenchmarkResult &) override
This virtual method is called after a benchmark has been run enough times to produce usable data.
Definition
qjunittestlogger_p.h:50
QJUnitTestLogger::leaveTestFunction
void leaveTestFunction() override
This virtual method is called after a test function has completed, to match \l enterTestFunction().
Definition
qjunittestlogger.cpp:173
QTestJUnitStreamer
Definition
qtestjunitstreamer_p.h:30
qtbase
src
testlib
qjunittestlogger_p.h
Generated on
for Qt by
1.18.0