qt5base-lts/tests/auto/testlib/selftests
Ivan Solovev 0681a2dd5a QTestLib: rework QTest::compare_helper()
[ChangeLog][QTestLib] QCOMPARE now evaluates toString() on its
arguments lazily, speeding up the general case where the comparison
doesn't fail. This is true for the QCOMPARE functionality provided
by Qt. If you specialized qCompare() for your own types, then you
need to change its implementation in line with Qt's own qCompare()
specializations in order to enable this feature.

[ChangeLog][QTestLib] QCOMPARE calls with nullptr argument(s) will
now print the actual and expected values upon failure.

Previously it was not like that because of the compareHelper()
overload in qtestresult.cpp that treated the presence of
nullptr-arguments as a reason to ignore formatFailMessage() call.
New implementation does not have this check, and correctly
executes formatFailMessage() for all arguments.

Note that the qCompare() overloads that call QTestResult::compare()
internally were not affected by this patch, because they already
defer toString() invocation until the comparison fails.

Some numbers, collected against shared release developer build.
I checked how this change affects the test execution. The idea was
to pick some tests for types that do not have a specific
QTestResult::compare overload, so I picked a couple of QByteArray
tests.
The comparison is done by running a test 10 times and taking the
average execution duration, as reported in the log.

tst_qbytearrayapisymmetry:
 Before: 15.6 ms
 After:  14.2 ms

tst_qbytearray:
 Before: 41 ms
 After:  36 ms

The benefit is around 9% and 12% respectively.

Fixes: QTBUG-98874
Change-Id: I7d59ddc760168b15974e7720930f629fb34efa13
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-06-03 20:37:51 +00:00
..
assert Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
badxml Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
benchlibcallgrind Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
benchlibcounting Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
benchlibeventcounter Guard the use of QWinEventNotifier in tests 2022-05-17 02:51:22 +02:00
benchliboptions Guard the use of QWinEventNotifier in tests 2022-05-17 02:51:22 +02:00
benchlibtickcounter Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
benchlibwalltime Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
blacklisted Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
cmptest Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
commandlinedata Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
counting Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
crashes Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
datatable Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
datetime Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
deleteLater Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
deleteLater_noApp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
differentexec Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
exceptionthrow Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
expectfail Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
extendedcompare Add QTRY_COMPARE_{EQ,NE,LT,LE,GT,GE}_WITH_TIMEOUT() 2022-06-03 22:37:50 +02:00
failcleanup Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
faildatatype Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
failfetchtype Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
failinit Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
failinitdata Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
fetchbogus Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
findtestdata Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
float Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
globaldata Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
junit Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
keyboard Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
longstring Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
maxwarnings Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
mouse Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
multiexec Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
pairdiagnostics Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
pass Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
patches Catch2: upgrade to 2.13.8 2022-01-31 09:26:00 +02:00
printdatatags Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
printdatatagswithglobaltags Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qexecstringlist Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
signaldumper Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
silent Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
singleskip Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
skip Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
skipcleanup Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
skipinit Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
skipinitdata Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
sleep Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
strcmp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
subtest Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
testlib QTestLib: rework QTest::compare_helper() 2022-06-03 20:37:51 +00:00
tuplediagnostics Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
verbose1 Remove .prev_CMakeLists.txt files 2021-01-12 20:59:13 +01:00
verbose2 Remove .prev_CMakeLists.txt files 2021-01-12 20:59:13 +01:00
verifyexceptionthrown Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
warnings Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
watchdog Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
.gitignore Revert "Remove unused overload of QTest::qExec." 2011-12-12 10:43:44 +01:00
CATCH_LICENSE.txt Rewrite Qt Testlib selftest to not rely on Qt Testlib itself 2020-05-11 15:42:28 +02:00
catch_p_p.h Catch2: upgrade to 2.13.8 2022-01-31 09:26:00 +02:00
catch_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
catch.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
CMakeLists.txt Add QCOMPARE_{EQ,NE,LT,LE,GT,GE}() 2022-06-03 22:37:50 +02:00
expected_assert.junitxml testlib: Move stdout/stderr reporting into individual <testcase> elements 2021-08-10 18:06:36 +02:00
expected_assert.lightxml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_assert.tap Move TAP's messages block to after the primary report details 2022-03-29 22:21:58 +02:00
expected_assert.teamcity testlib: Pass on file location on failure, but don't assume we have one 2021-08-04 17:31:51 +00:00
expected_assert.txt testlib: Pass on file location on failure, but don't assume we have one 2021-08-04 17:31:51 +00:00
expected_assert.xml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_badxml.junitxml testlib: Don't write redundant log message information in JUnit reporter 2021-08-10 18:06:36 +02:00
expected_badxml.lightxml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_badxml.xml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_benchlibcallgrind_0.txt Fix x86 preprocessor check in testlib selftests 2021-12-09 20:54:25 +01:00
expected_benchlibcallgrind_1.txt Fix x86 preprocessor check in testlib selftests 2021-12-09 20:54:25 +01:00
expected_benchlibcallgrind_2.txt Fix x86 preprocessor check in testlib selftests 2021-12-09 20:54:25 +01:00
expected_benchlibcounting.csv Add a CSV logging feature to the benchlib 2014-02-14 00:34:25 +01:00
expected_benchlibcounting.junitxml testlib: Move stdout/stderr reporting into individual <testcase> elements 2021-08-10 18:06:36 +02:00
expected_benchlibcounting.lightxml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_benchlibcounting.tap testlib selftest: rebaseline tap results to not include line numbers 2020-07-22 23:23:01 +02:00
expected_benchlibcounting.txt generate_expected_output.py: update generated expected_* files 2017-10-11 09:59:44 +00:00
expected_benchlibcounting.xml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_benchlibeventcounter.csv Add a CSV logging feature to the benchlib 2014-02-14 00:34:25 +01:00
expected_benchlibeventcounter.junitxml testlib: Move stdout/stderr reporting into individual <testcase> elements 2021-08-10 18:06:36 +02:00
expected_benchlibeventcounter.lightxml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_benchlibeventcounter.tap testlib: Add Test Anything Protocol (TAP) reporter 2018-03-14 14:28:36 +00:00
expected_benchlibeventcounter.txt generate_expected_output.py: update generated expected_* files 2017-10-11 09:59:44 +00:00
expected_benchlibeventcounter.xml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_benchliboptions.txt generate_expected_output.py: update generated expected_* files 2017-10-11 09:59:44 +00:00
expected_benchlibtickcounter.csv Make counts of various types of test result add up correctly 2022-01-13 19:47:22 +01:00
expected_benchlibtickcounter.junitxml testlib: Move stdout/stderr reporting into individual <testcase> elements 2021-08-10 18:06:36 +02:00
expected_benchlibtickcounter.lightxml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_benchlibtickcounter.tap testlib: Add Test Anything Protocol (TAP) reporter 2018-03-14 14:28:36 +00:00
expected_benchlibtickcounter.txt generate_expected_output.py: update generated expected_* files 2017-10-11 09:59:44 +00:00
expected_benchlibtickcounter.xml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_benchlibwalltime.csv Add a CSV logging feature to the benchlib 2014-02-14 00:34:25 +01:00
expected_benchlibwalltime.junitxml testlib: Move stdout/stderr reporting into individual <testcase> elements 2021-08-10 18:06:36 +02:00
expected_benchlibwalltime.lightxml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_benchlibwalltime.tap testlib: Add Test Anything Protocol (TAP) reporter 2018-03-14 14:28:36 +00:00
expected_benchlibwalltime.txt generate_expected_output.py: update generated expected_* files 2017-10-11 09:59:44 +00:00
expected_benchlibwalltime.xml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_blacklisted.junitxml Make counts of various types of test result add up correctly 2022-01-13 19:47:22 +01:00
expected_blacklisted.lightxml Make counts of various types of test result add up correctly 2022-01-13 19:47:22 +01:00
expected_blacklisted.tap TAP test logger: report B?XFAIL (mostly) as a message 2022-03-29 22:21:58 +02:00
expected_blacklisted.teamcity Make counts of various types of test result add up correctly 2022-01-13 19:47:22 +01:00
expected_blacklisted.txt Make counts of various types of test result add up correctly 2022-01-13 19:47:22 +01:00
expected_blacklisted.xml Make counts of various types of test result add up correctly 2022-01-13 19:47:22 +01:00
expected_cmptest.junitxml testlib: Move stdout/stderr reporting into individual <testcase> elements 2021-08-10 18:06:36 +02:00
expected_cmptest.lightxml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_cmptest.tap QTestlib: Add formatting for QObject * in QCOMPARE 2021-05-26 11:02:48 +00:00
expected_cmptest.teamcity QTestlib: Add formatting for QObject * in QCOMPARE 2021-05-26 11:02:48 +00:00
expected_cmptest.txt QTestlib: Add formatting for QObject * in QCOMPARE 2021-05-26 11:02:48 +00:00
expected_cmptest.xml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_commandlinedata.junitxml testlib: Don't write redundant log message information in JUnit reporter 2021-08-10 18:06:36 +02:00
expected_commandlinedata.lightxml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_commandlinedata.tap Move TAP's messages block to after the primary report details 2022-03-29 22:21:58 +02:00
expected_commandlinedata.teamcity generate_expected_output.py: update generated expected_* files 2017-10-11 09:59:44 +00:00
expected_commandlinedata.txt generate_expected_output.py: update generated expected_* files 2017-10-11 09:59:44 +00:00
expected_commandlinedata.xml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_counting.junitxml testlib: Don't write redundant log message information in JUnit reporter 2021-08-10 18:06:36 +02:00
expected_counting.lightxml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_counting.tap Move TAP's messages block to after the primary report details 2022-03-29 22:21:58 +02:00
expected_counting.teamcity Make Skip an incident in test logging 2021-12-09 20:54:26 +01:00
expected_counting.txt generate_expected_output.py: update generated expected_* files 2017-10-11 09:59:44 +00:00
expected_counting.xml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_crashes_1.txt QtTest: Output correct library name 2013-05-27 00:41:46 +02:00
expected_crashes_2.txt Add support for blacklisting test functions 2014-09-21 20:58:41 +02:00
expected_crashes_3.txt testlib: Pass on file location on failure, but don't assume we have one 2021-08-04 17:31:51 +00:00
expected_crashes_4.txt testlib: Pass on file location on failure, but don't assume we have one 2021-08-04 17:31:51 +00:00
expected_crashes_5.txt Merge remote-tracking branch 'origin/5.13' into dev 2019-02-20 09:51:12 +01:00
expected_datatable.junitxml testlib: Move stdout/stderr reporting into individual <testcase> elements 2021-08-10 18:06:36 +02:00
expected_datatable.lightxml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_datatable.tap testlib selftest: rebaseline tap results to not include line numbers 2020-07-22 23:23:01 +02:00
expected_datatable.teamcity generate_expected_output.py: update generated expected_* files 2017-10-11 09:59:44 +00:00
expected_datatable.txt generate_expected_output.py: update generated expected_* files 2017-10-11 09:59:44 +00:00
expected_datatable.xml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_datetime.junitxml testlib: Move stdout/stderr reporting into individual <testcase> elements 2021-08-10 18:06:36 +02:00
expected_datetime.lightxml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_datetime.tap testlib selftest: rebaseline tap results to not include line numbers 2020-07-22 23:23:01 +02:00
expected_datetime.teamcity generate_expected_output.py: update generated expected_* files 2017-10-11 09:59:44 +00:00
expected_datetime.txt generate_expected_output.py: update generated expected_* files 2017-10-11 09:59:44 +00:00
expected_datetime.xml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_deleteLater_noApp.junitxml Match up testlib selftest's lists of generated files 2021-12-09 20:54:25 +01:00
expected_deleteLater_noApp.lightxml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_deleteLater_noApp.tap Match up testlib selftest's lists of generated files 2021-12-09 20:54:25 +01:00
expected_deleteLater_noApp.teamcity Match up testlib selftest's lists of generated files 2021-12-09 20:54:25 +01:00
expected_deleteLater_noApp.txt Match up testlib selftest's lists of generated files 2021-12-09 20:54:25 +01:00
expected_deleteLater_noApp.xml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_deleteLater.junitxml Match up testlib selftest's lists of generated files 2021-12-09 20:54:25 +01:00
expected_deleteLater.lightxml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_deleteLater.tap Match up testlib selftest's lists of generated files 2021-12-09 20:54:25 +01:00
expected_deleteLater.teamcity Match up testlib selftest's lists of generated files 2021-12-09 20:54:25 +01:00
expected_deleteLater.txt Match up testlib selftest's lists of generated files 2021-12-09 20:54:25 +01:00
expected_deleteLater.xml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_differentexec.txt generate_expected_output.py: update generated expected_* files 2017-10-11 09:59:44 +00:00
expected_exceptionthrow.junitxml testlib: Move stdout/stderr reporting into individual <testcase> elements 2021-08-10 18:06:36 +02:00
expected_exceptionthrow.lightxml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_exceptionthrow.tap testlib selftest: rebaseline tap results to not include line numbers 2020-07-22 23:23:01 +02:00
expected_exceptionthrow.teamcity generate_expected_output.py: update generated expected_* files 2017-10-11 09:59:44 +00:00
expected_exceptionthrow.txt generate_expected_output.py: update generated expected_* files 2017-10-11 09:59:44 +00:00
expected_exceptionthrow.xml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_expectfail.junitxml Make counts of various types of test result add up correctly 2022-01-13 19:47:22 +01:00
expected_expectfail.lightxml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_expectfail.tap TAP test logger: report B?XFAIL (mostly) as a message 2022-03-29 22:21:58 +02:00
expected_expectfail.teamcity Make Skip an incident in test logging 2021-12-09 20:54:26 +01:00
expected_expectfail.txt Make counts of various types of test result add up correctly 2022-01-13 19:47:22 +01:00
expected_expectfail.xml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_extendedcompare.junitxml Add QTRY_COMPARE_{EQ,NE,LT,LE,GT,GE}_WITH_TIMEOUT() 2022-06-03 22:37:50 +02:00
expected_extendedcompare.lightxml Add QTRY_COMPARE_{EQ,NE,LT,LE,GT,GE}_WITH_TIMEOUT() 2022-06-03 22:37:50 +02:00
expected_extendedcompare.tap Add QTRY_COMPARE_{EQ,NE,LT,LE,GT,GE}_WITH_TIMEOUT() 2022-06-03 22:37:50 +02:00
expected_extendedcompare.teamcity Add QTRY_COMPARE_{EQ,NE,LT,LE,GT,GE}_WITH_TIMEOUT() 2022-06-03 22:37:50 +02:00
expected_extendedcompare.txt Add QTRY_COMPARE_{EQ,NE,LT,LE,GT,GE}_WITH_TIMEOUT() 2022-06-03 22:37:50 +02:00
expected_extendedcompare.xml Add QTRY_COMPARE_{EQ,NE,LT,LE,GT,GE}_WITH_TIMEOUT() 2022-06-03 22:37:50 +02:00
expected_failcleanup.junitxml testlib: Move stdout/stderr reporting into individual <testcase> elements 2021-08-10 18:06:36 +02:00
expected_failcleanup.lightxml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_failcleanup.tap testlib selftest: rebaseline tap results to not include line numbers 2020-07-22 23:23:01 +02:00
expected_failcleanup.teamcity generate_expected_output.py: update generated expected_* files 2017-10-11 09:59:44 +00:00
expected_failcleanup.txt generate_expected_output.py: update generated expected_* files 2017-10-11 09:59:44 +00:00
expected_failcleanup.xml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_faildatatype.junitxml testlib: Don't write redundant log message information in JUnit reporter 2021-08-10 18:06:36 +02:00
expected_faildatatype.lightxml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_faildatatype.tap Move TAP's messages block to after the primary report details 2022-03-29 22:21:58 +02:00
expected_faildatatype.teamcity testlib: Pass on file location on failure, but don't assume we have one 2021-08-04 17:31:51 +00:00
expected_faildatatype.txt testlib: Pass on file location on failure, but don't assume we have one 2021-08-04 17:31:51 +00:00
expected_faildatatype.xml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_failfetchtype.junitxml testlib: Move stdout/stderr reporting into individual <testcase> elements 2021-08-10 18:06:36 +02:00
expected_failfetchtype.lightxml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_failfetchtype.tap Move TAP's messages block to after the primary report details 2022-03-29 22:21:58 +02:00
expected_failfetchtype.teamcity testlib: Pass on file location on failure, but don't assume we have one 2021-08-04 17:31:51 +00:00
expected_failfetchtype.txt testlib: Pass on file location on failure, but don't assume we have one 2021-08-04 17:31:51 +00:00
expected_failfetchtype.xml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_failinit.junitxml testlib: Move stdout/stderr reporting into individual <testcase> elements 2021-08-10 18:06:36 +02:00
expected_failinit.lightxml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_failinit.tap testlib selftest: rebaseline tap results to not include line numbers 2020-07-22 23:23:01 +02:00
expected_failinit.teamcity generate_expected_output.py: update generated expected_* files 2017-10-11 09:59:44 +00:00
expected_failinit.txt generate_expected_output.py: update generated expected_* files 2017-10-11 09:59:44 +00:00
expected_failinit.xml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_failinitdata.junitxml testlib: Move stdout/stderr reporting into individual <testcase> elements 2021-08-10 18:06:36 +02:00
expected_failinitdata.lightxml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_failinitdata.tap testlib selftest: rebaseline tap results to not include line numbers 2020-07-22 23:23:01 +02:00
expected_failinitdata.teamcity generate_expected_output.py: update generated expected_* files 2017-10-11 09:59:44 +00:00
expected_failinitdata.txt generate_expected_output.py: update generated expected_* files 2017-10-11 09:59:44 +00:00
expected_failinitdata.xml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_fetchbogus.junitxml testlib: Move stdout/stderr reporting into individual <testcase> elements 2021-08-10 18:06:36 +02:00
expected_fetchbogus.lightxml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_fetchbogus.tap Move TAP's messages block to after the primary report details 2022-03-29 22:21:58 +02:00
expected_fetchbogus.teamcity testlib: Pass on file location on failure, but don't assume we have one 2021-08-04 17:31:51 +00:00
expected_fetchbogus.txt testlib: Pass on file location on failure, but don't assume we have one 2021-08-04 17:31:51 +00:00
expected_fetchbogus.xml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_findtestdata.junitxml testlib: Don't write redundant log message information in JUnit reporter 2021-08-10 18:06:36 +02:00
expected_findtestdata.lightxml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_findtestdata.tap Move TAP's messages block to after the primary report details 2022-03-29 22:21:58 +02:00
expected_findtestdata.teamcity generate_expected_output.py: update generated expected_* files 2017-10-11 09:59:44 +00:00
expected_findtestdata.txt generate_expected_output.py: update generated expected_* files 2017-10-11 09:59:44 +00:00
expected_findtestdata.xml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_float.txt Update float16 part of TestLib selftest 2021-07-28 21:26:55 +02:00
expected_globaldata.junitxml testlib: Don't write redundant log message information in JUnit reporter 2021-08-10 18:06:36 +02:00
expected_globaldata.lightxml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_globaldata.tap Move TAP's messages block to after the primary report details 2022-03-29 22:21:58 +02:00
expected_globaldata.teamcity Make Skip an incident in test logging 2021-12-09 20:54:26 +01:00
expected_globaldata.txt Fix the skip-check in TestMethods::invokeTest() 2019-03-29 14:00:03 +00:00
expected_globaldata.xml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_junit.junitxml testlib: Don't write redundant log message information in JUnit reporter 2021-08-10 18:06:36 +02:00
expected_keyboard.junitxml testlib: Move stdout/stderr reporting into individual <testcase> elements 2021-08-10 18:06:36 +02:00
expected_keyboard.lightxml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_keyboard.tap Add self-tests for QTest::keyPress() and QTest::keyRelease() 2018-05-07 14:53:18 +00:00
expected_keyboard.teamcity Add self-tests for QTest::keyPress() and QTest::keyRelease() 2018-05-07 14:53:18 +00:00
expected_keyboard.txt Add self-tests for QTest::keyPress() and QTest::keyRelease() 2018-05-07 14:53:18 +00:00
expected_keyboard.xml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_longstring.junitxml testlib: Move stdout/stderr reporting into individual <testcase> elements 2021-08-10 18:06:36 +02:00
expected_longstring.lightxml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_longstring.tap testlib selftest: rebaseline tap results to not include line numbers 2020-07-22 23:23:01 +02:00
expected_longstring.teamcity generate_expected_output.py: update generated expected_* files 2017-10-11 09:59:44 +00:00
expected_longstring.txt generate_expected_output.py: update generated expected_* files 2017-10-11 09:59:44 +00:00
expected_longstring.xml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_maxwarnings.junitxml testlib: Don't write redundant log message information in JUnit reporter 2021-08-10 18:06:36 +02:00
expected_maxwarnings.lightxml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_maxwarnings.tap Move TAP's messages block to after the primary report details 2022-03-29 22:21:58 +02:00
expected_maxwarnings.teamcity testlib: Rename QAbstractTestLogger::QSystem to QCritical 2021-08-10 18:06:36 +02:00
expected_maxwarnings.txt testlib: Rename QAbstractTestLogger::QSystem to QCritical 2021-08-10 18:06:36 +02:00
expected_maxwarnings.xml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_mouse.junitxml Match up testlib selftest's lists of generated files 2021-12-09 20:54:25 +01:00
expected_mouse.lightxml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_mouse.tap Match up testlib selftest's lists of generated files 2021-12-09 20:54:25 +01:00
expected_mouse.teamcity Make Skip an incident in test logging 2021-12-09 20:54:26 +01:00
expected_mouse.txt Match up testlib selftest's lists of generated files 2021-12-09 20:54:25 +01:00
expected_mouse.xml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_multiexec.txt generate_expected_output.py: update generated expected_* files 2017-10-11 09:59:44 +00:00
expected_pairdiagnostics.junitxml testlib: Move stdout/stderr reporting into individual <testcase> elements 2021-08-10 18:06:36 +02:00
expected_pairdiagnostics.lightxml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_pairdiagnostics.tap QTest: fix -Wformat-overflow GCC warning 2021-07-01 06:44:30 +02:00
expected_pairdiagnostics.teamcity QTest: fix -Wformat-overflow GCC warning 2021-07-01 06:44:30 +02:00
expected_pairdiagnostics.txt QTest: fix -Wformat-overflow GCC warning 2021-07-01 06:44:30 +02:00
expected_pairdiagnostics.xml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_pass.junitxml testlib: Move stdout/stderr reporting into individual <testcase> elements 2021-08-10 18:06:36 +02:00
expected_pass.lightxml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_pass.tap Add 'pass' test to testlib selftests 2020-03-05 15:18:04 +01:00
expected_pass.teamcity Add 'pass' test to testlib selftests 2020-03-05 15:18:04 +01:00
expected_pass.txt Add 'pass' test to testlib selftests 2020-03-05 15:18:04 +01:00
expected_pass.xml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_printdatatags.txt Fixing naming of selftests. 2011-12-05 09:02:15 +01:00
expected_printdatatagswithglobaltags.txt Fixing naming of selftests. 2011-12-05 09:02:15 +01:00
expected_qexecstringlist.txt generate_expected_output.py: update generated expected_* files 2017-10-11 09:59:44 +00:00
expected_signaldumper.junitxml testlib: Don't write redundant log message information in JUnit reporter 2021-08-10 18:06:36 +02:00
expected_signaldumper.lightxml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_signaldumper.tap Move TAP's messages block to after the primary report details 2022-03-29 22:21:58 +02:00
expected_signaldumper.teamcity testlib: Defer signal dumper start until tests are ready to run 2020-07-22 23:23:16 +02:00
expected_signaldumper.txt testlib: Defer signal dumper start until tests are ready to run 2020-07-22 23:23:16 +02:00
expected_signaldumper.xml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_silent.txt Make Skip an incident in test logging 2021-12-09 20:54:26 +01:00
expected_singleskip.junitxml testlib: Move stdout/stderr reporting into individual <testcase> elements 2021-08-10 18:06:36 +02:00
expected_singleskip.lightxml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_singleskip.tap testlib: Add Test Anything Protocol (TAP) reporter 2018-03-14 14:28:36 +00:00
expected_singleskip.teamcity Make Skip an incident in test logging 2021-12-09 20:54:26 +01:00
expected_singleskip.txt generate_expected_output.py: update generated expected_* files 2017-10-11 09:59:44 +00:00
expected_singleskip.xml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_skip.junitxml testlib: Don't write redundant log message information in JUnit reporter 2021-08-10 18:06:36 +02:00
expected_skip.lightxml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_skip.tap TAP test logger: move messages into the diagnostics block 2022-03-29 00:05:12 +01:00
expected_skip.teamcity Make Skip an incident in test logging 2021-12-09 20:54:26 +01:00
expected_skip.txt generate_expected_output.py: update generated expected_* files 2017-10-11 09:59:44 +00:00
expected_skip.xml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_skipcleanup.junitxml testlib: Move stdout/stderr reporting into individual <testcase> elements 2021-08-10 18:06:36 +02:00
expected_skipcleanup.lightxml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_skipcleanup.tap testlib: Add Test Anything Protocol (TAP) reporter 2018-03-14 14:28:36 +00:00
expected_skipcleanup.teamcity Make Skip an incident in test logging 2021-12-09 20:54:26 +01:00
expected_skipcleanup.txt generate_expected_output.py: update generated expected_* files 2017-10-11 09:59:44 +00:00
expected_skipcleanup.xml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_skipinit.junitxml testlib: Move stdout/stderr reporting into individual <testcase> elements 2021-08-10 18:06:36 +02:00
expected_skipinit.lightxml Make counts of various types of test result add up correctly 2022-01-13 19:47:22 +01:00
expected_skipinit.tap Make counts of various types of test result add up correctly 2022-01-13 19:47:22 +01:00
expected_skipinit.teamcity Make counts of various types of test result add up correctly 2022-01-13 19:47:22 +01:00
expected_skipinit.txt Make counts of various types of test result add up correctly 2022-01-13 19:47:22 +01:00
expected_skipinit.xml Make counts of various types of test result add up correctly 2022-01-13 19:47:22 +01:00
expected_skipinitdata.junitxml testlib: Move stdout/stderr reporting into individual <testcase> elements 2021-08-10 18:06:36 +02:00
expected_skipinitdata.lightxml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_skipinitdata.tap testlib: Add Test Anything Protocol (TAP) reporter 2018-03-14 14:28:36 +00:00
expected_skipinitdata.teamcity Make Skip an incident in test logging 2021-12-09 20:54:26 +01:00
expected_skipinitdata.txt generate_expected_output.py: update generated expected_* files 2017-10-11 09:59:44 +00:00
expected_skipinitdata.xml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_sleep.txt Fix integer overflows in QDeadlineTimer 2019-05-08 17:19:44 +00:00
expected_strcmp.junitxml testlib: Don't write redundant log message information in JUnit reporter 2021-08-10 18:06:36 +02:00
expected_strcmp.lightxml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_strcmp.tap TAP test logger: report B?XFAIL (mostly) as a message 2022-03-29 22:21:58 +02:00
expected_strcmp.teamcity generate_expected_output.py: update generated expected_* files 2017-10-11 09:59:44 +00:00
expected_strcmp.txt generate_expected_output.py: update generated expected_* files 2017-10-11 09:59:44 +00:00
expected_strcmp.xml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_subtest.junitxml Make counts of various types of test result add up correctly 2022-01-13 19:47:22 +01:00
expected_subtest.lightxml Make counts of various types of test result add up correctly 2022-01-13 19:47:22 +01:00
expected_subtest.tap Move TAP's messages block to after the primary report details 2022-03-29 22:21:58 +02:00
expected_subtest.teamcity Make counts of various types of test result add up correctly 2022-01-13 19:47:22 +01:00
expected_subtest.txt Make counts of various types of test result add up correctly 2022-01-13 19:47:22 +01:00
expected_subtest.xml Make counts of various types of test result add up correctly 2022-01-13 19:47:22 +01:00
expected_testlib.junitxml QTestLib: rework QTest::compare_helper() 2022-06-03 20:37:51 +00:00
expected_testlib.lightxml QTestLib: rework QTest::compare_helper() 2022-06-03 20:37:51 +00:00
expected_testlib.tap QTestLib: rework QTest::compare_helper() 2022-06-03 20:37:51 +00:00
expected_testlib.teamcity QTestLib: rework QTest::compare_helper() 2022-06-03 20:37:51 +00:00
expected_testlib.txt QTestLib: rework QTest::compare_helper() 2022-06-03 20:37:51 +00:00
expected_testlib.xml QTestLib: rework QTest::compare_helper() 2022-06-03 20:37:51 +00:00
expected_tuplediagnostics.junitxml testlib: Move stdout/stderr reporting into individual <testcase> elements 2021-08-10 18:06:36 +02:00
expected_tuplediagnostics.lightxml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_tuplediagnostics.tap testlib selftest: rebaseline tap results to not include line numbers 2020-07-22 23:23:01 +02:00
expected_tuplediagnostics.teamcity Eliminate some stray misleading paths from expected output files 2019-01-16 18:47:41 +00:00
expected_tuplediagnostics.txt Eliminate some stray misleading paths from expected output files 2019-01-16 18:47:41 +00:00
expected_tuplediagnostics.xml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_verbose1.junitxml testlib: Don't write redundant log message information in JUnit reporter 2021-08-10 18:06:36 +02:00
expected_verbose1.lightxml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_verbose1.tap Move TAP's messages block to after the primary report details 2022-03-29 22:21:58 +02:00
expected_verbose1.teamcity Make Skip an incident in test logging 2021-12-09 20:54:26 +01:00
expected_verbose1.txt generate_expected_output.py: update generated expected_* files 2017-10-11 09:59:44 +00:00
expected_verbose1.xml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_verbose2.junitxml testlib: Don't write redundant log message information in JUnit reporter 2021-08-10 18:06:36 +02:00
expected_verbose2.lightxml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_verbose2.tap Move TAP's messages block to after the primary report details 2022-03-29 22:21:58 +02:00
expected_verbose2.teamcity Make Skip an incident in test logging 2021-12-09 20:54:26 +01:00
expected_verbose2.txt generate_expected_output.py: update generated expected_* files 2017-10-11 09:59:44 +00:00
expected_verbose2.xml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_verifyexceptionthrown.junitxml Long live QVERIFY_THROWS_NO_EXCEPTION! 2021-11-26 18:28:50 +01:00
expected_verifyexceptionthrown.lightxml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_verifyexceptionthrown.tap Long live QVERIFY_THROWS_NO_EXCEPTION! 2021-11-26 18:28:50 +01:00
expected_verifyexceptionthrown.teamcity Long live QVERIFY_THROWS_NO_EXCEPTION! 2021-11-26 18:28:50 +01:00
expected_verifyexceptionthrown.txt Long live QVERIFY_THROWS_NO_EXCEPTION! 2021-11-26 18:28:50 +01:00
expected_verifyexceptionthrown.xml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_warnings.junitxml Make counts of various types of test result add up correctly 2022-01-13 19:47:22 +01:00
expected_warnings.lightxml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_warnings.tap Move TAP's messages block to after the primary report details 2022-03-29 22:21:58 +02:00
expected_warnings.teamcity Make Skip an incident in test logging 2021-12-09 20:54:26 +01:00
expected_warnings.txt Make counts of various types of test result add up correctly 2022-01-13 19:47:22 +01:00
expected_warnings.xml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_watchdog.junitxml testlib: Move stdout/stderr reporting into individual <testcase> elements 2021-08-10 18:06:36 +02:00
expected_watchdog.lightxml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
expected_watchdog.tap Move TAP's messages block to after the primary report details 2022-03-29 22:21:58 +02:00
expected_watchdog.teamcity testlib: Pass on file location on failure, but don't assume we have one 2021-08-04 17:31:51 +00:00
expected_watchdog.txt testlib: Pass on file location on failure, but don't assume we have one 2021-08-04 17:31:51 +00:00
expected_watchdog.xml Properly indent qtestlib's XML output 2021-12-17 07:03:26 +01:00
generate_expected_output.py Add QCOMPARE_{EQ,NE,LT,LE,GT,GE}() 2022-06-03 22:37:50 +02:00
qt_attribution.json Catch2: upgrade to 2.13.8 2022-01-31 09:26:00 +02:00
README testlib selftest: Add README explaining how to run and debug tests 2020-07-21 13:43:51 +02:00
tst_selftests.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Running the QtTestLib selftests with Catch2
===========================================

Catch2 [1] is a header only test framework that we use to allow
testing QtTestLib without relying on any part of testlib itself.

To run the test suite, execute 'make check' or './tst_selftests'
as normal. This should print:

    ===================================================================
    All tests passed (2453 assertions in 5 test cases)

To run specific tests, first lists the available tests:

     ./tst_selftests -l
    All available test cases:
      Loggers support both old and new style arguments
      Loggers can output to both file and stdout
      Logging to file and stdout at the same time
      All loggers can be enabled at the same time
      Scenario: Test output of the loggers is as expected
    5 test cases

Then pass the name of the test in quotes as the first argument:

     ./tst_selftests "Loggers support both old and new style arguments"
    Filters: Loggers support both old and new style arguments
    ==================================================================
    All tests passed (96 assertions in 1 test case)

You can find the tests in the sources as individual TEST_CASE
entries. Note that each of these tests run the tests once per
logger, and in the case of the test log check also all sub tests,
so the amount of actual test assertions is much higher than the
five tests listed above.

To see what the tests is actually doing, pass the -s option.
This will result in very verbose output. Each leaf test is
prefixed with a heading:

    ---------------------------------------------------------------
          Given: The QTestLog::TAP logger
           When: Passing arguments with new style
    ---------------------------------------------------------------

You can choose a specific subtest by passing the -c option:

     ./tst_selftests "Scenario: Test output of the loggers is as expected" \
        -c "Given: The QTestLog::Plain logger" \
        -c 'And given: The "skip" subtest'

It's possible to pass only the first -c options, to e.g. run all
tests with the Plain logger, but it's unfortunately not possible
to pass only the last -c option, to run the 'skip' subtest with
all loggers.

If a test fails it will print the expected, actual, and difference.
The test results are also left in a temporary directory for closer
inspection.

Add new tests by modifying selftest.pri and CMakeLists.txt, adding
a new subprogram.

Generating new test expectations is done using the python script
in this directory (generate_expected_output.py). In the future this
will be done with the --rebase option to ./tst_selftest, but this
is not fleshed out yet.

[1] https://github.com/catchorg/Catch2