13d2e13290
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>
161 lines
5.3 KiB
Plaintext
161 lines
5.3 KiB
Plaintext
TAP version 13
|
|
# tst_Subtest
|
|
# initTestCase initTestCase (null)
|
|
ok 1 - initTestCase()
|
|
# init test1 (null)
|
|
# test1 test1 (null)
|
|
# cleanup test1 (null)
|
|
ok 2 - test1()
|
|
# test2_data test2 (null)
|
|
# test2_data end
|
|
# init test2 data0
|
|
# test2 test2 data0
|
|
# test2 end
|
|
# cleanup test2 data0
|
|
ok 3 - test2(data0)
|
|
# init test2 data1
|
|
# test2 test2 data1
|
|
# test2 end
|
|
# cleanup test2 data1
|
|
ok 4 - test2(data1)
|
|
# init test2 data2
|
|
# test2 test2 data2
|
|
# test2 end
|
|
# cleanup test2 data2
|
|
ok 5 - test2(data2)
|
|
# test3_data test3 (null)
|
|
# test3_data end
|
|
# init test3 data0
|
|
# test3 test3 data0
|
|
# test3 end
|
|
# cleanup test3 data0
|
|
ok 6 - test3(data0)
|
|
# init test3 data1
|
|
# test3 test3 data1
|
|
not ok 7 - test3(data1)
|
|
---
|
|
type: QCOMPARE
|
|
message: Compared values are not the same
|
|
wanted: "hello0" (QString("hello0"))
|
|
found: "hello1" (str)
|
|
expected: "hello0" (QString("hello0"))
|
|
actual: "hello1" (str)
|
|
at: tst_Subtest::test3() (qtbase/tests/auto/testlib/selftests/subtest/tst_subtest.cpp:0)
|
|
file: qtbase/tests/auto/testlib/selftests/subtest/tst_subtest.cpp
|
|
line: 0
|
|
...
|
|
# cleanup test3 data1
|
|
# init test3 data2
|
|
# test3 test3 data2
|
|
not ok 8 - test3(data2)
|
|
---
|
|
type: QCOMPARE
|
|
message: Compared values are not the same
|
|
wanted: "hello0" (QString("hello0"))
|
|
found: "hello2" (str)
|
|
expected: "hello0" (QString("hello0"))
|
|
actual: "hello2" (str)
|
|
at: tst_Subtest::test3() (qtbase/tests/auto/testlib/selftests/subtest/tst_subtest.cpp:0)
|
|
file: qtbase/tests/auto/testlib/selftests/subtest/tst_subtest.cpp
|
|
line: 0
|
|
...
|
|
# cleanup test3 data2
|
|
# init multiFail (null)
|
|
not ok 9 - multiFail()
|
|
---
|
|
# This failure message should be repeated ten times
|
|
at: tst_Subtest::multiFail() (qtbase/tests/auto/testlib/selftests/subtest/tst_subtest.cpp:0)
|
|
file: qtbase/tests/auto/testlib/selftests/subtest/tst_subtest.cpp
|
|
line: 0
|
|
...
|
|
not ok 9 - multiFail()
|
|
---
|
|
# This failure message should be repeated ten times
|
|
at: tst_Subtest::multiFail() (qtbase/tests/auto/testlib/selftests/subtest/tst_subtest.cpp:0)
|
|
file: qtbase/tests/auto/testlib/selftests/subtest/tst_subtest.cpp
|
|
line: 0
|
|
...
|
|
not ok 9 - multiFail()
|
|
---
|
|
# This failure message should be repeated ten times
|
|
at: tst_Subtest::multiFail() (qtbase/tests/auto/testlib/selftests/subtest/tst_subtest.cpp:0)
|
|
file: qtbase/tests/auto/testlib/selftests/subtest/tst_subtest.cpp
|
|
line: 0
|
|
...
|
|
not ok 9 - multiFail()
|
|
---
|
|
# This failure message should be repeated ten times
|
|
at: tst_Subtest::multiFail() (qtbase/tests/auto/testlib/selftests/subtest/tst_subtest.cpp:0)
|
|
file: qtbase/tests/auto/testlib/selftests/subtest/tst_subtest.cpp
|
|
line: 0
|
|
...
|
|
not ok 9 - multiFail()
|
|
---
|
|
# This failure message should be repeated ten times
|
|
at: tst_Subtest::multiFail() (qtbase/tests/auto/testlib/selftests/subtest/tst_subtest.cpp:0)
|
|
file: qtbase/tests/auto/testlib/selftests/subtest/tst_subtest.cpp
|
|
line: 0
|
|
...
|
|
not ok 9 - multiFail()
|
|
---
|
|
# This failure message should be repeated ten times
|
|
at: tst_Subtest::multiFail() (qtbase/tests/auto/testlib/selftests/subtest/tst_subtest.cpp:0)
|
|
file: qtbase/tests/auto/testlib/selftests/subtest/tst_subtest.cpp
|
|
line: 0
|
|
...
|
|
not ok 9 - multiFail()
|
|
---
|
|
# This failure message should be repeated ten times
|
|
at: tst_Subtest::multiFail() (qtbase/tests/auto/testlib/selftests/subtest/tst_subtest.cpp:0)
|
|
file: qtbase/tests/auto/testlib/selftests/subtest/tst_subtest.cpp
|
|
line: 0
|
|
...
|
|
not ok 9 - multiFail()
|
|
---
|
|
# This failure message should be repeated ten times
|
|
at: tst_Subtest::multiFail() (qtbase/tests/auto/testlib/selftests/subtest/tst_subtest.cpp:0)
|
|
file: qtbase/tests/auto/testlib/selftests/subtest/tst_subtest.cpp
|
|
line: 0
|
|
...
|
|
not ok 9 - multiFail()
|
|
---
|
|
# This failure message should be repeated ten times
|
|
at: tst_Subtest::multiFail() (qtbase/tests/auto/testlib/selftests/subtest/tst_subtest.cpp:0)
|
|
file: qtbase/tests/auto/testlib/selftests/subtest/tst_subtest.cpp
|
|
line: 0
|
|
...
|
|
not ok 9 - multiFail()
|
|
---
|
|
# This failure message should be repeated ten times
|
|
at: tst_Subtest::multiFail() (qtbase/tests/auto/testlib/selftests/subtest/tst_subtest.cpp:0)
|
|
file: qtbase/tests/auto/testlib/selftests/subtest/tst_subtest.cpp
|
|
line: 0
|
|
...
|
|
not ok 9 - multiFail()
|
|
---
|
|
# But this test should only contribute one to the failure count
|
|
at: tst_Subtest::multiFail() (qtbase/tests/auto/testlib/selftests/subtest/tst_subtest.cpp:0)
|
|
file: qtbase/tests/auto/testlib/selftests/subtest/tst_subtest.cpp
|
|
line: 0
|
|
...
|
|
# cleanup multiFail (null)
|
|
# init multiSkip (null)
|
|
ok 10 - multiSkip() # SKIP This skip should be repeated ten times
|
|
ok 10 - multiSkip() # SKIP This skip should be repeated ten times
|
|
ok 10 - multiSkip() # SKIP This skip should be repeated ten times
|
|
ok 10 - multiSkip() # SKIP This skip should be repeated ten times
|
|
ok 10 - multiSkip() # SKIP This skip should be repeated ten times
|
|
ok 10 - multiSkip() # SKIP This skip should be repeated ten times
|
|
ok 10 - multiSkip() # SKIP This skip should be repeated ten times
|
|
ok 10 - multiSkip() # SKIP This skip should be repeated ten times
|
|
ok 10 - multiSkip() # SKIP This skip should be repeated ten times
|
|
ok 10 - multiSkip() # SKIP This skip should be repeated ten times
|
|
ok 10 - multiSkip() # SKIP But this test should only contribute one to the skip count
|
|
# cleanup multiSkip (null)
|
|
# cleanupTestCase cleanupTestCase (null)
|
|
ok 11 - cleanupTestCase()
|
|
1..11
|
|
# tests 11
|
|
# pass 7
|
|
# fail 3
|