Questions tagged [qtestlib]

Qt Test is a framework for unit testing Qt based applications and libraries.

Qt Test provides functionality usually found in unit testing frameworks as well as extensions for testing GUI applications.

Qt Test is designed specially for Qt based applications and libraries.

Official documentation can be found here.

139 questions
4
votes
0 answers

QTest dosnt compile

/usr/include/qt5/QtTest/qtestmouse.h:161: undefined reference to `QTest::defaultMouseDelay()' /usr/include/qt5/QtTest/qtestmouse.h:206: undefined reference to `QTest::qWarn(char const*, char const*, int)' collect2: error: ld returned 1…
YYY
  • 191
  • 16
4
votes
1 answer

Qt Creator Unit Test Project

In Qt Creator, when I create a new Unit Test project it will not build successfully if the full path to the project contains a space. I've tracked the bug down to the makefile produced by qmake. The makefile contains a line near the top…
mjk99
  • 1,290
  • 11
  • 18
4
votes
1 answer

QTestLib unit test framework + Gmock (Create QTCPServer - Mock Object)

I am using Qt's QTestLib unit test framework + GMOck. I am trying to set up mock server using gMock to simply receive data from a QTcpSocket to VerifySendData() method in a unit test. If someone would give me a example how I can create mock object…
user1029083
  • 153
  • 3
  • 3
  • 7
3
votes
1 answer

CMake subdirectory - No such file or directory for included header file when compiling test subproject

I have relatively complex cmake project with multiple sub-projects - one for third party software (which also includes further sub-projects), one for the application I'm working on and one for the tests. project: CMakeLists.txt | …
rbaleksandar
  • 8,713
  • 7
  • 76
  • 161
3
votes
2 answers

QT: simulated unit-testing

Is it possible to run an application and on top of that, you send keyPress events to the app and test the results using qtestlib? If yes, can somebody give me an example how to do it? If no, can somebody show me a better way accomplish the above…
Owen
  • 4,063
  • 17
  • 58
  • 78
3
votes
0 answers

How to pass multiple types into single QTest::addColumn call

I have a template function for serializing data to a file and another to retrieve it back using the ID returned by the fist function: template int serialize(const T &value); //returns id template T deserialize(int id); Now I…
Resurrection
  • 3,916
  • 2
  • 34
  • 56
3
votes
1 answer

How to test signal-slot connections with qtest

I am just starting out with QT and would like to have unit tests. I found a blueprint for a project structure that supports having tests outside my application. For my first test I wanted to have a click on the "Quit" menu point, checking that the…
3
votes
0 answers

Test QFileDialog with Qt Test

I am trying to write a unit test for a GUI application using the QTestLib. The problem is that one of the slots creates a file dialog using exec() and I found no possibility to interact with the dialog. The slots which creates the dialog is…
Anbu
  • 91
  • 7
3
votes
1 answer

How to compose multiple unit test result in a single txt file

I am using QTestLib Library and QTest for running my unit tests. I am working on windows 7 and using Qt 4.8 When I run my test using: int main(int argc, char *argv[]) { // Test gui widgets - 2 Spinboxes and 1 Combobox QApplication a(argc,…
3
votes
1 answer

How to create dependency injection for testing QTcpSocket?

I'm trying to write unit tests for a Qt5 application that I wrote, but I'm stumped about how to handle the classes that involve networking. My main class includes a QTcpServer subclass, which overrides QTcpServer::incomingConnection to create a…
thinkmassive
  • 758
  • 6
  • 15
3
votes
2 answers

Qt Test QVERIFY2() string and int concatenation

Sorry for the bad title, I have no idea how to title this question. Please edit and make it better. I am writing a test using the Qt test framework, and I'm trying to write some useful output to be used by the QVERIFY2() macro. All of the following…
Freedom_Ben
  • 11,247
  • 10
  • 69
  • 89
3
votes
1 answer

Unit testing with QTestLib

I'm trying to unit-testing my Qt application with QTestLib. I saw that the new Visual Studio 2012 has a built-in C++ test framework and googling for it I saw this page that talks about different methods to test a native project. I would have two…
Stefano
  • 3,213
  • 9
  • 60
  • 101
3
votes
0 answers

Trying to set a QDeclarativeScriptString in a unit test (QTestLib)

I'm trying to create a benchmark for part of my 2D game framework (It's a QML extension) and I'm having problems to set a declarative script property of a QOBject. The property declaration: Q_PROPERTY(QDeclarativeScriptString script READ script…
rzan
  • 426
  • 1
  • 3
  • 10
3
votes
1 answer

How to get the information from QTestLib/QTest on test failure

I am using QTestLib Library and QTest for running my unit tests. I am working on windows 7 and using Qt 4.8 with the MVSC 2010 compiler. When I run my test using: QTest::qExec(TestDateDD/whateverTestClass); I get the output in the…
SAM
  • 365
  • 1
  • 4
  • 10
2
votes
0 answers

How to export selenium results to qTest

Instead of running and publishing results selenium tests from qTest, I want to execute selenium tests from local or other PC and publish the results into qTest. Do we have an API available or any process to export the results to qTest? Thanks!
sattar kf
  • 21
  • 1
1 2
3
9 10