summaryrefslogtreecommitdiffstats
path: root/src/testlib/qtestlightxmlstreamer.cpp
diff options
context:
space:
mode:
authorMagne Pettersen Zachrisen <magne.zachrisen@tandberg.com>2010-08-10 19:52:06 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2010-08-11 14:22:09 (GMT)
commit56396b4b2b66da3133aff1b3864c550ce892d233 (patch)
treed783766e74ef9914e60a350921745ceef63069b5 /src/testlib/qtestlightxmlstreamer.cpp
parentef0d191e3d138f695a39128b6040d0884821f5b5 (diff)
downloadQt-56396b4b2b66da3133aff1b3864c550ce892d233.zip
Qt-56396b4b2b66da3133aff1b3864c550ce892d233.tar.gz
Qt-56396b4b2b66da3133aff1b3864c550ce892d233.tar.bz2
Added -random option to tests, making the test cases within a test execute in arbitrary order. Very useful for avoiding test cases being dependent on the running order.
Added -seed option -random to make it possible to reroduce test results. The seed is printed out when -random is specified Added selftests for -random and -seed options Changed int parsing into strtol and QTime->QDateTime as suggested by Mr Macieira, fixed selftests Merge-request: 2362 Reviewed-by: Thiago Macieira <thiago.macieira@nokia.com>
Diffstat (limited to 'src/testlib/qtestlightxmlstreamer.cpp')
-rw-r--r--src/testlib/qtestlightxmlstreamer.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/testlib/qtestlightxmlstreamer.cpp b/src/testlib/qtestlightxmlstreamer.cpp
index 0ac9ea8..cc5397a 100644
--- a/src/testlib/qtestlightxmlstreamer.cpp
+++ b/src/testlib/qtestlightxmlstreamer.cpp
@@ -42,6 +42,7 @@
#include "qtestlightxmlstreamer.h"
#include "qtestelement.h"
#include "qtestelementattribute.h"
+#include "qtestlogger_p.h"
#include "QtTest/private/qtestlog_p.h"
#include "QtTest/private/qtestresult_p.h"
@@ -164,8 +165,13 @@ void QTestLightXmlStreamer::formatBeforeAttributes(const QTestElement *element,
void QTestLightXmlStreamer::output(QTestElement *element) const
{
QTestCharBuffer buf;
- QTest::qt_asprintf(&buf, "<Environment>\n <QtVersion>%s</QtVersion>\n <QTestVersion>%s</QTestVersion>\n",
+ if (logger()->hasRandomSeed()) {
+ QTest::qt_asprintf(&buf, "<Environment>\n <QtVersion>%s</QtVersion>\n <QTestVersion>%s</QTestVersion>\n <RandomSeed>%d</RandomSeed>\n",
+ qVersion(), QTEST_VERSION_STR, logger()->randomSeed() );
+ } else {
+ QTest::qt_asprintf(&buf, "<Environment>\n <QtVersion>%s</QtVersion>\n <QTestVersion>%s</QTestVersion>\n",
qVersion(), QTEST_VERSION_STR );
+ }
outputString(buf.constData());
QTest::qt_asprintf(&buf, "</Environment>\n");