da18ada6bf
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>
58 lines
2.4 KiB
XML
58 lines
2.4 KiB
XML
<?xml version="1.0" encoding="UTF-8" ?>
|
|
<testsuite errors="11" failures="5" tests="12" name="tst_ExpectFail">
|
|
<properties>
|
|
<property value="5.0.0" name="QTestVersion"/>
|
|
<property value="5.0.0" name="QtVersion"/>
|
|
</properties>
|
|
<testcase result="pass" name="initTestCase"/>
|
|
<testcase result="xfail" name="xfailAndContinue">
|
|
<!-- message="begin" type="qdebug" -->
|
|
<!-- message="This should xfail" type="info" -->
|
|
<!-- message="after" type="qdebug" -->
|
|
</testcase>
|
|
<testcase result="xfail" name="xfailAndAbort">
|
|
<!-- message="begin" type="qdebug" -->
|
|
<!-- message="This should xfail" type="info" -->
|
|
</testcase>
|
|
<testcase result="fail" name="xfailTwice">
|
|
<failure message="Already expecting a fail" result="fail"/>
|
|
</testcase>
|
|
<testcase result="xfail" name="xfailWithQString">
|
|
<!-- message="A string" type="info" -->
|
|
<!-- message="Bug 5 (The message)" type="info" -->
|
|
</testcase>
|
|
<testcase result="xfail" name="xfailDataDriven">
|
|
<!-- tag="Abort" message="This test should xfail" type="info" -->
|
|
<!-- tag="Continue" message="This test should xfail" type="info" -->
|
|
</testcase>
|
|
<testcase result="pass" name="xfailOnWrongRow"/>
|
|
<testcase result="xfail" name="xfailOnAnyRow">
|
|
<!-- tag="first row" message="This test should xfail" type="info" -->
|
|
<!-- tag="second row" message="This test should xfail" type="info" -->
|
|
</testcase>
|
|
<testcase result="fail" name="xfailWithoutVerify">
|
|
<failure tag="first row" message="QEXPECT_FAIL was called without any subsequent verification statements" result="fail"/>
|
|
<failure tag="second row" message="QEXPECT_FAIL was called without any subsequent verification statements" result="fail"/>
|
|
</testcase>
|
|
<testcase result="xpass" name="xpass">
|
|
<failure message="'true' returned FALSE. ()" result="xpass"/>
|
|
</testcase>
|
|
<testcase result="xpass" name="xpassDataDriven">
|
|
<failure tag="XPass" message="'true' returned FALSE. ()" result="xpass"/>
|
|
</testcase>
|
|
<testcase result="pass" name="cleanupTestCase"/>
|
|
<system-err>
|
|
<![CDATA[begin]]>
|
|
<![CDATA[This should xfail]]>
|
|
<![CDATA[after]]>
|
|
<![CDATA[begin]]>
|
|
<![CDATA[This should xfail]]>
|
|
<![CDATA[A string]]>
|
|
<![CDATA[Bug 5 (The message)]]>
|
|
<![CDATA[This test should xfail]]>
|
|
<![CDATA[This test should xfail]]>
|
|
<![CDATA[This test should xfail]]>
|
|
<![CDATA[This test should xfail]]>
|
|
</system-err>
|
|
</testsuite>
|