summaryrefslogtreecommitdiffstats
path: root/src/testlib/qtestlog.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Add TeamCity logging feature to testlibBorgar Ovsthus2016-01-231-0/+4
| | | | | | | | | | | | | This allows TeamCity to parse realtime test-results instead of using post-build XML Report Processing. This does not support logging of benchmarks. [ChangeLog][QTest] Added a new logging mode that allow test-results to be parsed on-the-fly when using Jetbrains TeamCity as CI-server. This mode is enabled by using the -teamcity option on the command-line. Change-Id: Ie730beb643043eb0f448f99abe6c0b5ac48aaf03 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Updated license headersJani Heikkinen2016-01-151-14/+20
| | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Testlib: Output function / total time along with crash dump.Friedemann Kleint2015-10-131-0/+17
| | | | | | | | | | | | | | | | | | | Previously, only QXmlTestLogger had timers to take elapsed times and log them. Move those into class QTestLog for access by the loggers and output the times in the crash dump to make it easier to spot hangs/recursion crashes. Produces: QFATAL : foo() Received signal 11 Function time: 22ms Total time: 23ms A crash occurred in ... Function time: 24ms Total time: 26ms Task-number: QTBUG-47370 Change-Id: Ia530a63104087daffc9a15f68c15d93378b9407e Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Add XCTest logger backend to QtTestLibTor Arne Vestbø2015-03-271-0/+9
| | | | | | | | | | | | | | | | Will be active when running test apps through Xcode's 'test' action, and reports QtTestLib test objects and functions to Xcode as XCTest cases. This allows running tests on both iOS Simulator and iOS devices from the command line, through xcodebuild, without relying on any 3rd party tools. It also integrates Qt test failures and passes into the Xcode IDE, which may be useful for closer investigation of test failures. The feature is limited to Xcode 6.x. Change-Id: I33d39edbabdbaebef48d2d0eb7e08a1ffb72c397 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Add QtInfoMsgKai Koehne2015-01-091-1/+4
| | | | | | | | | | | | | | Add an 'info' message type that can be used for messages that are neither warnings (QtWarningMsg), nor for debugging only (QtDebugMsg). This is useful mainly for applications that do not have to adhere to the 'do not print anything by default' paradigm that we have for the Qt libraries itself. [ChangeLog][QtCore][Logging] QtInfoMsg got added as a new QtMsgType. Use the new qInfo(), qCInfo() macros to log to it. Change-Id: I810995d63de46c41a9a99a34d37c0d417fa87a05 Reviewed-by: Jason McDonald <macadder1@gmail.com>
* Remove trailing '\n' in qFormatLogMessage outputKai Koehne2014-10-271-1/+0
| | | | | | | | | | | | | | | Do not automatically add a \n to all messages formatted by qFormatLogMessage. Some backends require a final newline, some don't, so it's best to only append it where it's actually needed. The returned string will be null if the pattern is empty. This allows to differentiate between the case that the pattern just didn't apply (empty line is printed), and the case that qSetMessagePattern(QString()) have been called (nothing is printed). Change-Id: I17fde997a4074f58f82de6dea129948155c322d6 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-18/+10
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Add support for blacklisting test functionsLars Knoll2014-09-211-0/+25
| | | | | | | | | | | | | | | | | We need to have a finer grained control over the tests we skip in our CI system. This adds a blacklisting mechanism that allows blacklisting individual test functions (or even test data) using a set of predefined matching keys for the operating system and some other relevant variables. QTestlib will search for a file called BLACKLIST in the test directory and parse it if found. The file contains a simple ini style list of functions to blacklist. For details see qtestblacklist.cpp. Change-Id: Id3fae4b264ca99970cbf9f45bfb85fa75c1fd823 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Add qFormatLogMessage()Kai Koehne2014-07-301-4/+2
| | | | | | | | | | | | | | Export the former qMessageFormatString() as qFormatLogMessage(). This allows custom message handlers to format their messages just like the default message handler, taking qSetMessagePattern() / QT_MESSAGE_PATTERN into account. The method should arguably not add the '\n' at the end, which a follow up commit will fix. Change-Id: Ib2a9cfda91473df079daf03bf3197e6ac63e013e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* Fix QtTestlib build under QT_NO_REGULAREXPRESSIONGiuseppe D'Angelo2014-05-151-0/+8
| | | | | Change-Id: I4458226e814641269062990f272a40ca577bc9db Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add a CSV logging feature to the benchlibThiago Macieira2014-02-141-0/+4
| | | | | | | | | | | | | | | This is only useful for logging benchmarks, since it won't print test passes, failures, etc. It's useful for importing to spreadsheets to do number-crunching. [ChangeLog][QtTest]Added a CSV logging mode that is suitable for importing benchmark results into spreadsheets. This can be enabled by the -csv option on the command-line. The CSV logging mode will not print test failures, debug messages, warnings, etc. Change-Id: I245d6f86bb380645c9bc0d748cf474b3ed42cab8 Reviewed-by: Sergio Ahumada <sahumada@blackberry.com> Reviewed-by: Jason McDonald <macadder1@gmail.com>
* Testlib: Use QString for messages in QAbstractTestLogger::addMessage()Friedemann Kleint2014-01-211-14/+12
| | | | | | | | Task-number: QTBUG-35743 [ChangeLog][QtTest][Windows] Use correct UTF-8 encoding for XML test results on platforms with different console encoding. Change-Id: Ice9d03192098f931e5dac358928e0c4421ab715e Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2014-01-101-1/+6
|\ | | | | | | Change-Id: I99af0bef7f1c931533a324ebcfb27c40ee871a5e
| * QTestLib: use QT_MESSAGE_PATTERN when showing debug outputDavid Faure2014-01-061-1/+6
| | | | | | | | | | | | | | | | | | | | | | This makes debugging much more convenient, being able to see e.g. the method name where qDebug is used. Note that this doesn't break ignored messages, since qMessageFormatString is only called after the test for ignored messages. Change-Id: I7fc96e3f19efe48ac3a30fdd63e5b495c0d86e02 Reviewed-by: Kai Koehne <kai.koehne@digia.com> Reviewed-by: Jason McDonald <macadder1@gmail.com>
* | TestLib: Ignore trailing space in QTest::ignoreMessageKai Koehne2013-12-041-1/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | When comparing expected with actual debug messages, allow the expected ones to contain a trailing space. This is needed to not break all autotests in a follow up patch, which will prevent ~QDebug() from generating a trailing space by default. Task-number: QTBUG-15256 Change-Id: I7f67393ddfbfe37fde1ca5ef45e4ad7f4b5324b4 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com> Reviewed-by: Jason McDonald <macadder1@gmail.com>
* | Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-11-261-1/+0
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For the conflicts in msvc_nmake.cpp the ifdefs are extended since we need to support windows phone in the target branch while it is not there in the current stable branch (as of Qt 5.2). Conflicts: configure qmake/generators/win32/msvc_nmake.cpp src/3rdparty/angle/src/libEGL/Surface.cpp src/angle/src/common/common.pri src/corelib/global/qglobal.h src/corelib/io/qstandardpaths.cpp src/plugins/platforms/qnx/qqnxintegration.cpp src/plugins/platforms/qnx/qqnxscreeneventhandler.h src/plugins/platforms/xcb/qglxintegration.h src/widgets/kernel/win.pri tests/auto/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp tools/configure/configureapp.cpp Change-Id: I00b579eefebaf61d26ab9b00046d2b5bd5958812
| * Revert "Add tracing to logging framework"Kai Koehne2013-11-071-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The tracing API still misses some real-world exposure. Let's re-do this in dev to have more time. This reverts parts of following commits: 466e0dff4bb686e51d0ab3f905631fcb7dd8bfef 7a47aebe9ed41d6cd9c9bcd45758d4d553668e99 a652bab6a7ebf78b029fea95c2801deb6f4f524a 8f0654ceb878b6c8a08c7f5b790027c26e007c13 4162522edd9d31bd2798ab37f083adff818d886e 32f27b4367c4e042a3f0cda671579494e31c1d69 9ff81bdc1ab4e3d14914192cd63ae625a507fe90 Change-Id: If97340c37b8b3363f597683336a8390d5ff386f1 Reviewed-by: hjk <hjk121@nokiamail.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
* | Add overload of QTest::ignoreMessage() taking a QRegularExpression.Friedemann Kleint2013-11-171-17/+42
|/ | | | | | | Make it possible to match messages by a pattern. Change-Id: I713312e86db5471755459f1ecc43e8f1ac7a95fb Reviewed-by: Jason McDonald <macadder1@gmail.com>
* Expose QTest::currentAppName() and remove hard-coded argv[0] in testsTor Arne Vestbø2013-09-261-1/+1
| | | | | | | | Except where we're actually testing QCoreApplication::applicationName() and friends. Change-Id: I25514884c11f43a4f82b1f818f822dc3d79f69a3 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* Add tracing to logging frameworkhjk2013-09-251-0/+1
| | | | | | | | | Change-Id: I4d5b9a24a214785019ff1238c1790ead79205b15 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@digia.com> Reviewed-by: Topi Reiniö <topi.reinio@digia.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
* Don't use deprecated qInstallMsgHandler in testlibKai Koehne2013-08-161-35/+7
| | | | | | | | | | | | We kept using qInstallMsgHandler in testlib to not break test cases using it too. However, this breaks tests using qInstallMessageHandler ... ChangeLog: QTestLib: Test cases have to use qInstallMessageHandler instead of the (deprecated) qInstallMsgHandler Task-number: QTBUG-32391 Change-Id: I3bd95d9b0a48749243a5dd3e074df8ebcbc07dce Reviewed-by: Andy Shaw <andy.shaw@digia.com>
* Fix compiler warning about deprecated APIKai Koehne2013-05-221-0/+10
| | | | | | | | Explicitly disable warnings about qInstallMsgHandler being deprecated. We have to use it in testlib to not break test cases still using it. Change-Id: Icf7eb6c4d549f80ef45a4201fab2ac3eb03dda9e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Testlib: Disable gcc warning about deprecated qInstallMsgHandlerKai Koehne2012-11-011-0/+10
| | | | | | | Fix warning: 'void (* qInstallMsgHandler(QtMsgHandler))(QtMsgType, const char*)' is deprecated (declared at qtestlog.cpp:85) [-Wdeprecated-declarations] Change-Id: I28d2baf696fdeddec90780edc88574fc368468db Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Logging: Mark deprecated API with QT_DEPRECATEDKai Koehne2012-10-161-0/+8
| | | | | | | | | | Still use it in qtestlib though because using qInstallMessageHandler here would break all tests (still) using qInstallMsgHandler - Qt always uses the new message handler if there's one, ignoring any message handler installed through deprecated API. Change-Id: I6fefefb315a2421425d2b7787e367fd348a33d83 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* CodeCoverage: Handle QTest based subtests.Caroline Chao2012-02-121-2/+17
| | | | | | | | | | | | | | | | Set QT_TESTCOCOON_ACTIVE environment variable when the coverage is installed for a test and unset it when the coverage data is saved. Tests that run when QT_TESTCOCOON_ACTIVE is set are subtests and will not be considered as stand-alone tests for the coverage. When a test is run as a subtest its coverage data will not be saved for itself but for the main test it is merged with. Also its status will not be reported since only the status of the main test is expected in the test report, e.g. the test tests/auto/testlib/selftests. Change-Id: Icfdf99300aae18040e1a3441a8af21f68df4c0db Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com> Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
* testlib: Clear ignored messages after every data rowJason McDonald2012-02-081-1/+5
| | | | | | | | | | | | | | | | | | | | Previously, ignored messages were only cleared at the end of each test function, i.e. after all data rows were finished. This meant that if a data row in a data-driven test function didn't cause all of the expected messages to be generated, the remaining messages would be carried over to the next data row. This would result in errors about missing messages being associated with the last data row rather than with the correct data row. This commit makes testlib check for missing ignored messages after running each data row rather than only doing so after the last data row. This commit also adds a regression test to demonstrate that ignored messages can no longer be carried over from one data row to another. Change-Id: Ibee51aa6e96866fbcbcb4acee1a8340a86a6a4ba Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* CodeCoverage: Save coverage data in QTestLog::stopLogging()Caroline Chao2012-02-071-0/+17
| | | | | | | | | | | | | | | | | Currently when tests are crashing, aborting or hanging, their status are reported with a status "Unknown" because SaveCoverageTool is never called for them. The status of the test given by the coverage tool should be the same as the one reported in the log output when the test is run. This change will allow more accuracy in the status reported. Add QTestResult::setCurrentAppname and QTestResult::currentAppname. To retrieve the name of the current application running. Task-number: QTQAINFRA-460 Change-Id: Icc476dc2d6cb28185e5447f1e79da6a8a31cad54 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com> Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-301-1/+1
| | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: I311e001373776812699d6efc045b5f742890c689 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update contact information in license headers.Jason McDonald2012-01-231-1/+1
| | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Move pass/fail/skip counters from QTestResult to QTestLog.Jason McDonald2012-01-171-0/+34
| | | | | | | | | | | | | | | This change will enable further simplification of QTestResult and QTestLog in the future, including removing a circular dependency between the two classes. The "getter" functions in QTestResult are retained for now, but will be removed in a future commit, once QtQuickTest has been changed to call the getters that this commit adds to QTestLog. This commit is adapted from an unfinished change by Henrik Hartz. Change-Id: Ife7f80ac6a4310449a4712e96e0bea6c02139a5a Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Rename QTestLog::addIgnoreMessage to QTestLog::ignoreMessage.Jason McDonald2012-01-161-1/+1
| | | | | Change-Id: I4cfcd00d444d0812c58afab6ffd43dee37db1340 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update copyright year in license headers.Jason McDonald2012-01-051-1/+1
| | | | | Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Stop using QTest::qt_snprintf() in testlib.Jason McDonald2011-12-121-1/+1
| | | | | | | | After the previous commit, QTest::qt_snprintf() is equivalent to qsnprintf(), so just use that instead. Change-Id: I89ad6e3749ba5efb1926b0b618a904e8baca9f52 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Added -datatags option to QTestLibJo Asplin2011-11-041-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (Note: This feature is ported from Qt 4.8. See the following commits: 01575deafb7d26ca2431374e92c6d71de96547c7 4866d1ba8afbab61e102942d1ea93b81fea053d6 ) Passing the -datatags option to a QTestLib program prints the available data tags to standard output. For completeness, the test case name is also printed at the start of each output line. (Although the file name is supposed to match the lower-case version of the test case name, this is currently not true in all cases (particularly not under tests/benchmarks/). Even if there was a script to enforce this convention, the -datatags option provides this information in a reliable way.) Data tags for each test function (f() in this case) are printed in four different ways depending on the presence of local and global data tags: Case 1: No tags: tst_MyTestCasetst_MyTestCase f Case 2: Local tags only: tst_MyTestCase f local tag 1 tst_MyTestCase f local tag 2 ... Case 3: Global tags only: tst_MyTestCase f __global__ global tag 1 tst_MyTestCase f __global__ global tag 2 ... Case 4: Local and global tags: tst_MyTestCase f local tag 1 __global__ global tag 1 tst_MyTestCase f local tag 2 __global__ global tag 1 ... tst_MyTestCase f local tag 1 __global__ global tag 2 tst_MyTestCase f local tag 2 __global__ global tag 2 ... ... Note that the string __global__ is assumed to be highly unlikely to occur in a data tag (if it does, an ambiguity results). Change-Id: Ib51aa0c3c32ad52e52ce519729292cf8f0ec5d50 Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
* Make testlib use #include consistently.Jason McDonald2011-10-211-8/+8
| | | | | Change-Id: I36b5da3f832d2588072405d93143173edc29f4af Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Make all uses of QBasicAtomicInt and Pointer use load() and store()Thiago Macieira2011-10-031-1/+1
| | | | | | | | | | | | | | Most of these changes are search-and-replace of d->ref ==, d->ref != and d->ref =. The QBasicAtomicPointer in QObjectPrivate::Connection didn't need to be basic, so I made it QAtomicPointer. Change-Id: Ie3271abd1728af599f9ab17c6f4868e475f17bb6 Reviewed-on: http://codereview.qt-project.org/5030 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Make QTest::qWarn() use __FILE__ and __LINE__.Jason McDonald2011-09-281-2/+2
| | | | | | | | | | This change makes QTest::qWarn() consistent with similar testlib functions, which take __FILE__ and __LINE__. Change-Id: I12977cb30672899ab38877b4a656f0cc0c7ea02c Reviewed-on: http://codereview.qt-project.org/3559 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Allow tests to log to multiple destinationsJason McDonald2011-09-231-53/+139
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Each destination and the format of output to write there is specified by adding "-o filename,format" to the command-line. The special filename "-" indicates that the log output is written to the standard output stream, though standard output can be used as a destination at most once. The old-style testlib output options are still supported, but can only be used to specify one logging destination, as before. If no logging options are given on the command-line, a plain text log will go to the console, as before. To log to the console in plain text and to the file "test_output" in xunit format, one would invoke a test in the following way: tst_foo -o test_output,xunitxml -o -,txt This commit also enhances the selftests to test with multiple loggers, but negative tests (e.g. bad combinations of command-line options) are left for future task QTBUG-21567. Task-number: QTBUG-20615 Change-Id: If91e752bc7001657e15e427aba9d25ab0a29a0b0 Reviewed-on: http://codereview.qt-project.org/4125 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Pass log file name when constructing loggers.Jason McDonald2011-09-051-39/+23
| | | | | | | | | | | Pass the filename when creating the logger rather than when commencing output. This will simplify forthcoming changes for running multiple loggers. Change-Id: I563aa97661caf279a5dcccb1321ff3ce4725b332 Reviewed-on: http://codereview.qt.nokia.com/4116 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Simplify qtestlib logging code, part 2Jason McDonald2011-09-011-2/+2
| | | | | | | | | Rename the QTestLogger class to QXunitTestLogger. Change-Id: I7b93f9de4f4744e53997ccc001a745c36f375599 Reviewed-on: http://codereview.qt.nokia.com/3924 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Simplify qtestlib logging code, part 1Jason McDonald2011-09-011-16/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | Both the old and new XML loggers produce the Complete and Light XML log formats, while only the new logger produces Xunit XML logs. The disadvantage of the new logger is that it is more complex and doesn't produce a partial log if the test fails to terminate gracefully. This behaviour arises because Xunit format output cannot be written correctly until all tests have been executed. This commit removes the Complete and Light XML formats from the new logger, using the old logger to produce those formats and the new logger to produce only Xunit XML. Prior to this commit, the qtestlib selftests demonstrate that the old and new loggers produce identical output for Complete and Light XML. This commit also removes the undocumented -flush command-line option, which was used rather obscurely to select between the old and new loggers. The newer logger will be renamed to QXunitTestLogger in a subsequent commit. Change-Id: Id304f5b411bdd520409ee233f6bc34e8917942ab Reviewed-on: http://codereview.qt.nokia.com/3923 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Remove ability to run tests in random order.Jason McDonald2011-08-311-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <qt_sanity_bot@ovi.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Remove QTestLog constructor/destructor definitionsJason McDonald2011-08-291-8/+0
| | | | | | | | | | | | QTestLog is an entirely static class and its constructor and destructor are declared private to prevent accidental construction of an instance of the class. Therefore, the constructor and destructor do not need to be defined. Change-Id: I860f1344c5032091f5c641a20e1656bb52a6f07e Reviewed-on: http://codereview.qt.nokia.com/3466 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Add missing assertions.Jason McDonald2011-08-291-0/+3
| | | | | | | | | | | For both QTestLog::addFail() and QTestLog::addIgnoreMessage(), passing a null message does not make sense and is therefore an error that should be brought to the developer's attention. Change-Id: Ib09ad90b70d74f7432c08708db8a70dee008cce4 Reviewed-on: http://codereview.qt.nokia.com/3470 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Be more consistent when including private headers.Jason McDonald2011-08-291-3/+1
| | | | | | | Change-Id: I0fdc014391ff34ba3be9501c2e73bd5357df1f5e Reviewed-on: http://codereview.qt.nokia.com/3467 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Remove mode parameter from QTestLog::addSkip().Jason McDonald2011-08-291-2/+1
| | | | | | | | | | The mode parameter is never used by the logging code, so there's little value in passing it there. Change-Id: Ibe2cbe5eaf457a7e3ffd3aea3a4be7c8278c91b6 Reviewed-on: http://codereview.qt.nokia.com/3547 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Fix typo in enum name.Jason McDonald2011-08-291-2/+2
| | | | | | | Change-Id: I2eccbd3b9dd31aa5e869d622055f9235f90c0c03 Reviewed-on: http://codereview.qt.nokia.com/3445 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>