Questions tagged [qttest]

QtTest is a Qt module for unit testing Qt applications and libraries.

Documentation can be found here.

81 questions
0
votes
2 answers

grabToImage not working when using qmltestrunner.exe

newbee here on QML. Apologies if the question is too basic but I am stuck. I am trying something very simple, running a simple QML unit test, but it needs to grab the image of the window and saved to the file system. So I was looking at this…
gmmo
  • 2,577
  • 3
  • 30
  • 56
0
votes
0 answers

How to introduce my project to my unit test project in the c++ qt program

I'm pretty new in programming. I have a small project that I want to add a unit test to it. I add a new auto test project as new subprojet to my main project but I don't know how should I introduce and include my classes of another source subproject…
masoume
  • 33
  • 1
  • 6
0
votes
1 answer

How to set QT_QPA_PLATFORM for test

I have some Qt tests that pop up a window when run. Therefore i want to add possibility to disable their rendering.Can I set in cmake environment variable QT_QPA_PLATFORM to offscreeen only for test?
Lumar
  • 1
0
votes
1 answer

QtTest under PyQt5 fails when widgets-under-test have to be visible to work

I've started to create UI tests for my PyQt5 widgets using QtTest but have run into the following difficulties: In order to speed up things, some of my widgets only perform operations when visible. As it seems that QtTest runs with invisible…
Chipmuenk
  • 607
  • 1
  • 7
  • 22
0
votes
0 answers

Using QtTest inside a Library project

I'm confused on how I'm supposed to use the QtTest FrameWork inside a Library project (Windows). I have created a library project and added some tests, but I had a lot of issues trying to run the tests. The key to solve my problem was to…
Zavulon
  • 121
  • 8
0
votes
1 answer

How to use Qt Test module to test my own application?

I have a simple console application as below and I want to learn how to use Qt Test to test its functionalities. Honestly, I am trying to learn how to use Qt Test module. MyApplication.pro QT -= gui CONFIG += c++11 console CONFIG -=…
Hareen Laks
  • 1,432
  • 2
  • 17
  • 33
0
votes
0 answers

How to integrate Qt test framework with Qt C++

I have created a Qt project I want to have Qt unit test with it how can I include unit test in Qt C++.Can some one suggest a way to integrate it.
0
votes
1 answer

Disconnect qt timer for unit test

I'm trying to unit test some legacy code which is using QTimer for some periodic action basically: class MyClass : public QObject { Q_OBJECT public: explicit MyClass(QObject* parent = nullptr) : QObject(parent) { …
Libor Tomsik
  • 668
  • 7
  • 24
0
votes
0 answers

How to avoid Qt Test from timing out after 600s

Is it possible to ignore the MAX_VALUE of 600 sec at Qt-testing? I try: qputenv("QTEST_FUNCTION_TIMEOUT", "1000000"); // 1'000 sec but the result is: System.Exception: Process timed out: 600s So it is possible to increase the timeout from 300s to…
vho
  • 1
  • 1
0
votes
1 answer

Qt test mock dynamic linked library

I’m a little bit confused how to work with mock and dynamic linked libraries. Let’s assume a project structure like the following subdirs.pro (subdir project) \- app (subdir project) \-- app (executable, include and use lib) \-- lib (dynamic…
sandkasten
  • 603
  • 1
  • 8
  • 21
0
votes
1 answer

QTest is not showing dialogs

Qt 4.7.1 I have a qttest setup which has until recently been performing well. I have encountered, and dealt with, the need to interact with modal dialogs by using singleshot timers. However, I am now seeing the opposite behaviour; calls such as…
mike
  • 1,192
  • 9
  • 32
0
votes
1 answer

QTest : testing dialogs with sub dialogs

I am trying to create a test for a use case like this: A Dialog is opened Clicking on a button in this dialog opens a sub dialog Clicking on a button in the sub dialog closes it Some action is done in dialog after sub dialog has been closed I was…
Mickaël C. Guimarães
  • 1,020
  • 2
  • 14
  • 32
0
votes
1 answer

Warning about fallthrough inside qtestmouse?

I'm using QtTest and just updated to Qt 5.9 and have this kind of warnings: error: use of the 'fallthrough' attribute is a C++1z extension [-Werror,-Wc++1z-extensions] They all point to Q_FALLTHROUGH() in qtestmouse.h So obviously I need to add…
htzfun
  • 1,231
  • 10
  • 41
0
votes
1 answer

How to use QtTest with qbs

I can't find clear example of building tests with qbs. I tried like this import qbs CppApplication { consoleApplication: true files: [ "TestTask.h", "TestTask.cpp" ] Depends { name: "Qt"; submodules: [ "core", "testlib" ] } } TestTask is a…
alez
  • 69
  • 7
0
votes
1 answer

What does QTest::currentTestFailed() return for the init and cleanup TestCase functions?

Currently using QT 4.8 and according to the document the QTest::currentTestFailed() "Returns true if the current test function failed, otherwise false." I am not sure if this means the value will give the failed/succeeded result of the init…
Eaton Emmerich
  • 452
  • 4
  • 17