qt5base-lts/tests/auto/testlib/selftests/expected_subtest.junitxml
Edward Welbourne 13d2e13290 Make counts of various types of test result add up correctly
Added tests for repeated skips and failures (from within void lambdas,
to simulate skips and failures from within event handlers). These
exhibit yet more ways to count more than one outcome for a test.  The
new QTest::failOnWarning() can also provoke more than one failure from
a single test, and several existing selftests exhibited various ways
for the Totals line's counts to add up to more than the number of
actual tests run.

Fixed counting so that only the first decisive incident is counted.
Tests can still report later failure or skipping, but only the first
is counted.

Added a currentTestState in qtestlog.cpp, by which it keeps track of
whether the test has resolved to a result, and clearCurrentTestState()
by which other code can reset that at the end of each test. This
brought to light various places where test-end clean-up was not being
handled - due to failure or skipping in a *_data() method or init, or
a skip in cleanup.

Fixes: QTBUG-95661
Change-Id: I5d24a37a53d3db225fa602649d8aad8f5ed6c1ad
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-01-13 19:47:22 +01:00

108 lines
4.2 KiB
XML

<?xml version="1.0" encoding="UTF-8" ?>
<testsuite name="tst_Subtest" timestamp="@TEST_START_TIME@" hostname="@HOSTNAME@" tests="11" failures="3" errors="0" skipped="1" time="@TEST_DURATION@">
<properties>
<property name="QTestVersion" value="@INSERT_QT_VERSION_HERE@"/>
<property name="QtVersion" value="@INSERT_QT_VERSION_HERE@"/>
<property name="QtBuild" value=""/>
</properties>
<testcase name="initTestCase" classname="tst_Subtest" time="@TEST_DURATION@">
<system-out>
<![CDATA[initTestCase initTestCase (null)]]>
</system-out>
</testcase>
<testcase name="test1" classname="tst_Subtest" time="@TEST_DURATION@">
<system-out>
<![CDATA[init test1 (null)]]>
<![CDATA[test1 test1 (null)]]>
<![CDATA[cleanup test1 (null)]]>
</system-out>
</testcase>
<testcase name="test2(data0)" classname="tst_Subtest" time="@TEST_DURATION@">
<system-out>
<![CDATA[test2_data test2 (null)]]>
<![CDATA[test2_data end]]>
<![CDATA[init test2 data0]]>
<![CDATA[test2 test2 data0]]>
<![CDATA[test2 end]]>
<![CDATA[cleanup test2 data0]]>
</system-out>
</testcase>
<testcase name="test2(data1)" classname="tst_Subtest" time="@TEST_DURATION@">
<system-out>
<![CDATA[init test2 data1]]>
<![CDATA[test2 test2 data1]]>
<![CDATA[test2 end]]>
<![CDATA[cleanup test2 data1]]>
</system-out>
</testcase>
<testcase name="test2(data2)" classname="tst_Subtest" time="@TEST_DURATION@">
<system-out>
<![CDATA[init test2 data2]]>
<![CDATA[test2 test2 data2]]>
<![CDATA[test2 end]]>
<![CDATA[cleanup test2 data2]]>
</system-out>
</testcase>
<testcase name="test3(data0)" classname="tst_Subtest" time="@TEST_DURATION@">
<system-out>
<![CDATA[test3_data test3 (null)]]>
<![CDATA[test3_data end]]>
<![CDATA[init test3 data0]]>
<![CDATA[test3 test3 data0]]>
<![CDATA[test3 end]]>
<![CDATA[cleanup test3 data0]]>
</system-out>
</testcase>
<testcase name="test3(data1)" classname="tst_Subtest" time="@TEST_DURATION@">
<failure type="fail" message="Compared values are not the same">
<![CDATA[ Actual (str) : "hello1"
Expected (QString("hello0")): "hello0"]]>
</failure>
<system-out>
<![CDATA[init test3 data1]]>
<![CDATA[test3 test3 data1]]>
<![CDATA[cleanup test3 data1]]>
</system-out>
</testcase>
<testcase name="test3(data2)" classname="tst_Subtest" time="@TEST_DURATION@">
<failure type="fail" message="Compared values are not the same">
<![CDATA[ Actual (str) : "hello2"
Expected (QString("hello0")): "hello0"]]>
</failure>
<system-out>
<![CDATA[init test3 data2]]>
<![CDATA[test3 test3 data2]]>
<![CDATA[cleanup test3 data2]]>
</system-out>
</testcase>
<testcase name="multiFail" classname="tst_Subtest" time="@TEST_DURATION@">
<failure type="fail" message="This failure message should be repeated ten times"/>
<system-out>
<![CDATA[init multiFail (null)]]>
<![CDATA[cleanup multiFail (null)]]>
</system-out>
</testcase>
<testcase name="multiSkip" classname="tst_Subtest" time="@TEST_DURATION@">
<skipped message="This skip should be repeated ten times"/>
<skipped message="This skip should be repeated ten times"/>
<skipped message="This skip should be repeated ten times"/>
<skipped message="This skip should be repeated ten times"/>
<skipped message="This skip should be repeated ten times"/>
<skipped message="This skip should be repeated ten times"/>
<skipped message="This skip should be repeated ten times"/>
<skipped message="This skip should be repeated ten times"/>
<skipped message="This skip should be repeated ten times"/>
<skipped message="This skip should be repeated ten times"/>
<skipped message="But this test should only contribute one to the skip count"/>
<system-out>
<![CDATA[init multiSkip (null)]]>
<![CDATA[cleanup multiSkip (null)]]>
</system-out>
</testcase>
<testcase name="cleanupTestCase" classname="tst_Subtest" time="@TEST_DURATION@">
<system-out>
<![CDATA[cleanupTestCase cleanupTestCase (null)]]>
</system-out>
</testcase>
</testsuite>