27 case QAbstractTestLogger::Skip:
29 case QAbstractTestLogger::Pass:
31 case QAbstractTestLogger::XFail:
33 case QAbstractTestLogger::Fail:
35 case QAbstractTestLogger::XPass:
37 case QAbstractTestLogger::BlacklistedPass:
39 case QAbstractTestLogger::BlacklistedFail:
41 case QAbstractTestLogger::BlacklistedXPass:
43 case QAbstractTestLogger::BlacklistedXFail:
52 case QAbstractTestLogger::QDebug:
54 case QAbstractTestLogger::QInfo:
56 case QAbstractTestLogger::QWarning:
58 case QAbstractTestLogger::QCritical:
60 case QAbstractTestLogger::QFatal:
62 case QAbstractTestLogger::Info:
64 case QAbstractTestLogger::Warn:
85void QTeamCityLogger::startLogging()
87 QAbstractTestLogger::startLogging();
89 tcEscapedString(&flowID, QTestResult::currentTestObjectName());
92 QTest::qt_asprintf(&buf,
"##teamcity[testSuiteStarted name='%s' flowId='%s']\n",
93 flowID.constData(), flowID.constData());
94 outputString(buf.constData());
117void QTeamCityLogger::addIncident(IncidentTypes type,
const char *description,
118 const char *file,
int line)
121 if ((type == Pass || type == XFail || type == BlacklistedPass || type == BlacklistedXFail) && QTestLog::verboseLevel() < 0)
125 QTestCharBuffer tmpFuncName;
126 escapedTestFuncName(&tmpFuncName);
128 if (qstrcmp(tmpFuncName.constData(), currTestFuncName.constData()) != 0) {
129 QTest::qt_asprintf(&buf,
"##teamcity[testStarted name='%s' flowId='%s']\n",
130 tmpFuncName.constData(), flowID.constData());
131 outputString(buf.constData());
133 currTestFuncName.clear();
134 QTestPrivate::appendCharBuffer(&currTestFuncName, tmpFuncName);
137 if (type == QAbstractTestLogger::XFail) {
138 addPendingMessage(QTest::tcIncidentType2String(type), description, file, line);
142 QTestCharBuffer detailedText;
143 tcEscapedString(&detailedText, description);
146 if (type == Fail || type == XPass) {
147 QTestCharBuffer messageText;
149 QTest::qt_asprintf(&messageText,
"Failure! |[Loc: %s(%d)|]", file, line);
151 QTest::qt_asprintf(&messageText,
"Failure!");
153 QTest::qt_asprintf(&buf,
"##teamcity[testFailed name='%s' message='%s' details='%s'"
154 " flowId='%s']\n", tmpFuncName.constData(), messageText.constData(),
155 detailedText.constData(), flowID.constData());
157 outputString(buf.constData());
158 }
else if (type == Skip) {
160 QTestCharBuffer detail;
161 QTest::qt_asprintf(&detail,
" |[Loc: %s(%d)|]", file, line);
162 QTestPrivate::appendCharBuffer(&detailedText, detail);
165 QTest::qt_asprintf(&buf,
"##teamcity[testIgnored name='%s' message='%s' flowId='%s']\n",
166 currTestFuncName.constData(), detailedText.constData(),
169 outputString(buf.constData());
172 if (!pendingMessages.isEmpty()) {
173 QTest::qt_asprintf(&buf,
"##teamcity[testStdOut name='%s' out='%s' flowId='%s']\n",
174 tmpFuncName.constData(), pendingMessages.constData(),
177 outputString(buf.constData());
178 pendingMessages.clear();
181 QTest::qt_asprintf(&buf,
"##teamcity[testFinished name='%s' flowId='%s']\n",
182 tmpFuncName.constData(), flowID.constData());
183 outputString(buf.constData());
191void QTeamCityLogger::addMessage(MessageTypes type,
const QString &message,
192 const char *file,
int line)
195 if (type != QFatal && QTestLog::verboseLevel() < 0)
198 QTestCharBuffer escapedMessage;
199 tcEscapedString(&escapedMessage, qUtf8Printable(message));
200 addPendingMessage(QTest::tcMessageType2String(type), escapedMessage.constData(), file, line);
272 QTest::qt_asprintf(&newMessage,
"%s%s |[Loc: %s(%d)|]: %s", pad, type, file, line, msg);