From 527317748d00739994e3865b8f4e2525fc3ca2c7 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Mon, 29 Aug 2011 16:50:52 +1000 Subject: Remove ability to run tests in random order. Remove the undocumented feature that allows test functions to be executed in random order. The feature was designed to expose unintended dependencies between test functions -- test functions are only supposed to depend on the initTestCase() and init() functions. Aside from the lack of documentation, there are a number of problems with this feature. Most importantly, running the tests in random order has only a 50% chance of exposing dependencies between test functions. A better strategy would be to run the test functions in reverse order and complain if that produces different results to running the tests in the normal order. Additionally, the random order is not deterministic, so even if a dependency is exposed during a test run, there's no guarantee that it will be exposed again. The feature allows the user to optionally supply a random seed to make the "random" order deterministic, but as rand() implementations are not identical across platforms, even that does not guarantee that dependencies between test functions will be exposed deterministically. Change-Id: I39eac34c532ccb988116778bbc5ab05d835874c5 Reviewed-on: http://codereview.qt.nokia.com/3720 Reviewed-by: Qt Sanity Bot Reviewed-by: Rohan McGovern --- src/testlib/qtestlog.cpp | 9 --------- 1 file changed, 9 deletions(-) (limited to 'src/testlib/qtestlog.cpp') diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp index 36b69e1155..0a87a4ce14 100644 --- a/src/testlib/qtestlog.cpp +++ b/src/testlib/qtestlog.cpp @@ -281,15 +281,6 @@ void QTestLog::addBenchmarkResult(const QBenchmarkResult &result) QTest::testLogger->addBenchmarkResult(result); } -void QTestLog::startLogging(unsigned int randomSeed) -{ - QTEST_ASSERT(!QTest::testLogger); - QTest::initLogger(); - QTest::testLogger->registerRandomSeed(randomSeed); - QTest::testLogger->startLogging(QTest::outFile); - QTest::oldMessageHandler = qInstallMsgHandler(QTest::messageHandler); -} - void QTestLog::startLogging() { QTEST_ASSERT(!QTest::testLogger); -- cgit v1.2.3