Setting timeout in Qt Test

I use Qt Test to write unit tests for some complex computational algorithms. A process uses a significant amount of time, and when it starts on an older computer, the process crashes because the timeout is as follows:

********* Start testing of KnotTest *********
Config: Using QtTest library 5.6.2, Qt 5.6.2 (i386-little_endian-ilp32 shared (dynamic) release build; by MSVC 2013)
PASS   : MyTest::initTestCase()
QFATAL : MyTest::test_benchmark() Test function timed out
FAIL!  : MyTest::test_benchmark() Received a fatal error.
Unknown file(0) : failure location
Totals: 1 passed, 1 failed, 0 skipped, 0 blacklisted
********* Finished testing of KnotTest *********

How to configure a custom timeout for the created test program?

+4
source share
2 answers

You can override the timeout using an environment variable named QTEST_FUNCTION_TIMEOUT. The timeout should be indicated in milliseconds. By default, Qt uses a timeout of 300,000 milliseconds (5 minutes).

, , Qt.

, , qputenv:

http://doc.qt.io/qt-5/qtglobal.html#qputenv

+2

QtCreator

→ → → : -

. " " ​​ :

http://doc.qt.io/qtcreator/creator-autotest.html

+1

Source: https://habr.com/ru/post/1671734/


All Articles