diff options
author | Rohan McGovern <rohan.mcgovern@nokia.com> | 2009-05-19 03:33:21 (GMT) |
---|---|---|
committer | Rohan McGovern <rohan.mcgovern@nokia.com> | 2009-05-19 04:06:55 (GMT) |
commit | ba7e2d913deb4adeef071002e3518f43949e6a08 (patch) | |
tree | 820e1ae297c9b94550e1d932201aa5e409c53043 /tests/auto/selftests | |
parent | 73dd402265ebc07e8c86e42321e881a903ec316e (diff) | |
download | Qt-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 'tests/auto/selftests')
-rw-r--r-- | tests/auto/selftests/expected_xunit.txt | 13 | ||||
-rw-r--r-- | tests/auto/selftests/xunit/tst_xunit.cpp | 29 |
2 files changed, 41 insertions, 1 deletions
diff --git a/tests/auto/selftests/expected_xunit.txt b/tests/auto/selftests/expected_xunit.txt index 875dda6..cb74491 100644 --- a/tests/auto/selftests/expected_xunit.txt +++ b/tests/auto/selftests/expected_xunit.txt @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<testsuite errors="3" failures="2" tests="6" name="tst_Xunit"> +<testsuite errors="5" failures="3" tests="9" name="tst_Xunit"> <properties> <property value="4.6.0" name="QTestVersion"/> <property value="4.6.0" name="QtVersion"/> @@ -20,10 +20,21 @@ <testcase result="fail" name="testFunc4"> <failure message="a forced failure!" result="fail"/> </testcase> + <testcase result="xfail" name="testFunc5"> + <!-- message="this failure is expected" type="info" --> + </testcase> + <testcase result="xfail" name="testFunc6"> + <!-- message="this failure is also expected" type="info" --> + </testcase> + <testcase result="xpass" name="testFunc7"> + <failure message="'true' returned FALSE. ()" result="xpass"/> + </testcase> <testcase result="pass" name="cleanupTestCase"/> <system-err> <![CDATA[just a QWARN() !]]> <![CDATA[a qDebug() call with comment-ending stuff -->]]> <![CDATA[skipping this function!]]> +<![CDATA[this failure is expected]]> +<![CDATA[this failure is also expected]]> </system-err> </testsuite> diff --git a/tests/auto/selftests/xunit/tst_xunit.cpp b/tests/auto/selftests/xunit/tst_xunit.cpp index dbe9fec..c3c90ab 100644 --- a/tests/auto/selftests/xunit/tst_xunit.cpp +++ b/tests/auto/selftests/xunit/tst_xunit.cpp @@ -53,6 +53,9 @@ private slots: void testFunc2(); void testFunc3(); void testFunc4(); + void testFunc5(); + void testFunc6(); + void testFunc7(); }; tst_Xunit::tst_Xunit() @@ -81,6 +84,32 @@ void tst_Xunit::testFunc4() QFAIL("a forced failure!"); } +/* + Note there are two testfunctions which give expected failures. + This is so we can test that expected failures don't add to failure + counts and unexpected passes do. If we had one xfail and one xpass + testfunction, we couldn't test which one of them adds to the failure + count. +*/ + +void tst_Xunit::testFunc5() +{ + QEXPECT_FAIL("", "this failure is expected", Abort); + QVERIFY(false); +} + +void tst_Xunit::testFunc6() +{ + QEXPECT_FAIL("", "this failure is also expected", Abort); + QVERIFY(false); +} + +void tst_Xunit::testFunc7() +{ + QEXPECT_FAIL("", "this pass is unexpected", Abort); + QVERIFY(true); +} + QTEST_APPLESS_MAIN(tst_Xunit) #include "tst_xunit.moc" |