summaryrefslogtreecommitdiffstats
path: root/src/testlib/doc/src/qttestlib-manual.qdoc
diff options
context:
space:
mode:
Diffstat (limited to 'src/testlib/doc/src/qttestlib-manual.qdoc')
-rw-r--r--src/testlib/doc/src/qttestlib-manual.qdoc59
1 files changed, 45 insertions, 14 deletions
diff --git a/src/testlib/doc/src/qttestlib-manual.qdoc b/src/testlib/doc/src/qttestlib-manual.qdoc
index c99c947253..555d87ee64 100644
--- a/src/testlib/doc/src/qttestlib-manual.qdoc
+++ b/src/testlib/doc/src/qttestlib-manual.qdoc
@@ -109,6 +109,47 @@
For more examples, refer to the \l{Qt Test Tutorial}.
+ \section1 Increasing Test Function Timeout
+
+ QtTest limits the run-time of each test to catch infinite loops and similar
+ bugs. By default, any test function call will be interrupted after five
+ minutes. For data-driven tests, this applies to each call with a distinct
+ data-tag. This timeout can be configured by setting the \c QTEST_FUNCTION_TIMEOUT
+ environment variable to the maximum number of milliseconds that is acceptable
+ for a single call to take. If a test takes longer than the configured timeout,
+ it is interrupted, and \c qFatal() is called. As a result, the test aborts by
+ default, as if it had crashed.
+
+ To set \c QTEST_FUNCTION_TIMEOUT from the command line on Linux or macOS, enter:
+
+ \badcode
+ QTEST_FUNCTION_TIMEOUT=900000
+ export QTEST_FUNCTION_TIMEOUT
+ \endcode
+
+ On Windows:
+ \badcode
+ SET QTEST_FUNCTION_TIMEOUT=900000
+ \endcode
+
+ Then run the test inside this environment.
+
+ Alternatively, you can set the environment variable programmatically in the
+ test code itself, for example by calling, from the
+ \l{Creating a Test}{initMain()} special method of your test class:
+
+ \badcode
+ qputenv("QTEST_FUNCTION_TIMEOUT", "900000");
+ \endcode
+
+ To calculate a suitable value for the timeout, see how long the test usually
+ takes and decide how much longer it can take without that being a symptom of
+ some problem. Convert that longer time to milliseconds to get the timeout value.
+ For example, if you decide that a test that takes several minutes could
+ reasonably take up to twenty minutes, for example on a slow machine,
+ multiply \c{20 * 60 * 1000 = 1200000} and set the environment variable to
+ \c 1200000 instead of the \c 900000 above.
+
\if !defined(qtforpython)
\section1 Building a Test
@@ -671,7 +712,7 @@
\li result
\row
\li 0
- \li all lower
+ \li all-lower
\li "hello"
\li HELLO
\row
@@ -681,7 +722,7 @@
\li HELLO
\row
\li 2
- \li all upper
+ \li all-upper
\li "HELLO"
\li HELLO
\endtable
@@ -938,20 +979,10 @@
\snippet tutorial5/benchmarking.cpp 2
- The "if (useLocaleCompare)" switch is placed outside the QBENCHMARK
+ The \c{if (useLocaleCompare)} switch is placed outside the QBENCHMARK
macro to avoid measuring its overhead. Each benchmark test function
can have one active QBENCHMARK macro.
- \section1 External Tools
-
- Tools for handling and visualizing test data are available as part of
- the \l {qtestlib-tools} project.
- These include a tool for comparing performance data obtained from test
- runs and a utility to generate Web-based graphs of performance data.
-
- See the \l{qtestlib-tools Announcement}{qtestlib-tools announcement}
- for more information on these tools and a simple graphing example.
-
\section1 Building the Executable
\include {building-examples.qdocinc} {building the executable} {tutorial5}
@@ -977,7 +1008,7 @@
the execution of the test without adding a failure to the test log.
It can be used to skip tests that are certain to fail. The text in
the QSKIP \a description parameter is appended to the test log,
- and explains why the test was not carried out.
+ and should explain why the test was not carried out.
QSKIP can be used to skip testing when the implementation is not yet
complete or not supported on a certain platform. When there are known