Commit Graph

10 Commits

Author SHA1 Message Date
Jason McDonald
da18ada6bf testlib: Clear expected failures after every data row.
Previously, expected failures were only cleared at the end of each test
function, i.e. after all data rows were finished.  This meant that if a
data-driven test function called QEXPECT_FAIL and then didn't perform
any further verification steps to trigger the expected failure, the
expected failure would be carried over to the next data row, probably
causing the first verification step in the test function to XPASS (with
a seemingly irrelevant error message) for the next data row.

This commit adds the new function QTestResult::finishedCurrentTestData()
to cleanup after each data row is executed.  This function treats calls
to QEXPECT_FAIL without subsequent verification steps as a test failure.

This commit also adds a regression test to demonstrate that expected
failures can no longer be carried over from one data row to another. If
run against the previous version of testlib, the new test would report a
pass instead of an error.

Change-Id: Ida5c7f080815b0dca9531131fed582b0918334cb
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-02-08 03:13:21 +01:00
Jason McDonald
ef25df9fec Add selftest for xpass in a data-driven test.
Change-Id: I9491d1e17ad31453ec353a11c9efb31522a16459
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-02-02 05:42:07 +01:00
Jason McDonald
4d1dcaef19 Improve readability of expectfail selftest.
Rename some of the test functions to improve consistency, and change the
order so that all the xfail tests are together (some new xpass tests
will be added later).

Change-Id: Ice1ac5bf61bc26109bb0d08f72eb74e1a0424101
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-02-02 05:42:07 +01:00
Jason McDonald
0528d9dca7 Improve coverage of expectfail selftest
Add a test case for calling QEXPECT_FAIL in a data-driven test without
passing a specific data tag for the expected failure, in which the
expected failure should apply to the current data row.

Change-Id: I70a6592de77b1718c3a749fd2216e66f8f312805
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-01-13 04:04:17 +01:00
Jason McDonald
3dfdf34c1c Improve coverage of expectfail selftest
Add a test for the case where a call to QEXPECT_FAIL nominates a
different data row from the current row, in which case the call to
QEXPECT_FAIL should be ignored.

Change-Id: Iff774b89f9374fa26105acdd8769177272a95229
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-01-13 04:04:12 +01:00
Jason McDonald
fa07815892 Improve coverage of expectfail selftest.
Add a test for the case where QEXPECT_FAIL is called twice in a row
without an intervening verification step, which is supposed to result in
a failure.

Change-Id: Ie004652a76a2c35c2679945670ff5561e8f5b62e
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-01-13 01:41:14 +01:00
Jason McDonald
188db2b817 Make expectfail selftest test XPASS.
Change-Id: I0f7943049995c7fa4ad70a05fd2fdac4bc9f6ff6
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-01-12 06:41:39 +01:00
Jason McDonald
a59bc6a6e4 Improve selftest coverage of QEXPECT_FAIL feature.
The existing expectfail selftest did not test QEXPECT_FAIL with a
data-driven test function.  This commit adds such a test.

Change-Id: I39fa9aa227b58779ce5268dd37bf55468e7269c5
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-01-12 06:41:29 +01:00
Jason McDonald
47f016f519 Sanitize paths in selftest data.
Use a standard path for filenames that appear in the selftest's expected
test data.  This will make future patches smaller.

Change-Id: I04b2e739d261f80d20b834e5b33c5b6e88d26379
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-10-19 07:24:40 +02:00
Jo Asplin
87ee382419 Moved autotests in category 'testlib' into new directory structure
Task-number: QTBUG-21353

Change-Id: I2e2ad4b7570f80b3e6500821f769e967f0a75027
Reviewed-on: http://codereview.qt-project.org/4438
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-09-12 08:36:15 +02:00