summaryrefslogtreecommitdiffstats
path: root/src/testlib/qtestlogger.cpp
diff options
context:
space:
mode:
authorRohan McGovern <rohan.mcgovern@nokia.com>2009-05-19 03:33:21 (GMT)
committerRohan McGovern <rohan.mcgovern@nokia.com>2009-05-19 04:06:55 (GMT)
commitba7e2d913deb4adeef071002e3518f43949e6a08 (patch)
tree820e1ae297c9b94550e1d932201aa5e409c53043 /src/testlib/qtestlogger.cpp
parent73dd402265ebc07e8c86e42321e881a903ec316e (diff)
downloadQt-ba7e2d913deb4adeef071002e3518f43949e6a08.zip
Qt-ba7e2d913deb4adeef071002e3518f43949e6a08.tar.gz
Qt-ba7e2d913deb4adeef071002e3518f43949e6a08.tar.bz2
Fixed incorrect pass/fail semantics for xpass/xfail when using
xunitxml testlib logger. In the testlib plain logger, xfail is considered a pass and xpass considered a fail. xunitxml had the opposite behavior; change it to be the same. Autotest: included
Diffstat (limited to 'src/testlib/qtestlogger.cpp')
-rw-r--r--src/testlib/qtestlogger.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/testlib/qtestlogger.cpp b/src/testlib/qtestlogger.cpp
index 2249e8a..46af232 100644
--- a/src/testlib/qtestlogger.cpp
+++ b/src/testlib/qtestlogger.cpp
@@ -180,7 +180,7 @@ void QTestLogger::addIncident(IncidentTypes type, const char *description,
switch (type) {
case QAbstractTestLogger::XPass:
- ++passCounter;
+ ++failureCounter;
typeBuf = "xpass";
break;
case QAbstractTestLogger::Pass:
@@ -188,7 +188,7 @@ void QTestLogger::addIncident(IncidentTypes type, const char *description,
typeBuf = "pass";
break;
case QAbstractTestLogger::XFail:
- ++failureCounter;
+ ++passCounter;
typeBuf = "xfail";
break;
case QAbstractTestLogger::Fail:
@@ -200,7 +200,8 @@ void QTestLogger::addIncident(IncidentTypes type, const char *description,
break;
}
- if (type == QAbstractTestLogger::Fail || type == QAbstractTestLogger::XFail) {
+ if (type == QAbstractTestLogger::Fail || type == QAbstractTestLogger::XPass
+ || ((format != TLF_XunitXml) && (type == QAbstractTestLogger::XFail))) {
QTestElement *failureElement = new QTestElement(QTest::LET_Failure);
failureElement->addAttribute(QTest::AI_Result, typeBuf);
if(file)
@@ -230,10 +231,10 @@ void QTestLogger::addIncident(IncidentTypes type, const char *description,
if (!strcmp(oldResult, "pass")) {
overwrite = true;
}
- else if (!strcmp(oldResult, "xpass")) {
- overwrite = (type == QAbstractTestLogger::XFail || type == QAbstractTestLogger::Fail);
- }
else if (!strcmp(oldResult, "xfail")) {
+ overwrite = (type == QAbstractTestLogger::XPass || type == QAbstractTestLogger::Fail);
+ }
+ else if (!strcmp(oldResult, "xpass")) {
overwrite = (type == QAbstractTestLogger::Fail);
}
if (overwrite) {
@@ -251,6 +252,14 @@ void QTestLogger::addIncident(IncidentTypes type, const char *description,
QTest::qt_snprintf(buf, sizeof(buf), "%i", line);
currentLogElement->addAttribute(QTest::AI_Line, buf);
+
+ /*
+ Since XFAIL does not add a failure to the testlog in xunitxml, add a message, so we still
+ have some information about the expected failure.
+ */
+ if (format == TLF_XunitXml && type == QAbstractTestLogger::XFail) {
+ QTestLogger::addMessage(QAbstractTestLogger::Info, description, file, line);
+ }
}
void QTestLogger::addBenchmarkResult(const QBenchmarkResult &result)