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
7
votes
1 answer

Undefined symbols for QCompare

When building a test with QTestLib, I get an "undefined symbols" error for a qCompare function: Undefined symbols for architecture x86_64: "__ZN5QTest8qCompareIimEEbRKT_RKT0_PKcS8_S8_i", referenced from: __ZN15MyTestClass22myTestFunctionEv…
jlstrecker
  • 4,953
  • 3
  • 46
  • 60
6
votes
2 answers

How to simulate mouse wheel events using QTestLib [Qt5]

I am happily using QTestLib to write tests for my Qt5 widgets based UI. There has seemed to be no shortage of features and convenience functionality until now, when I tried to find a way to simulate mouse wheel events. I have looked at the official…
Mr. Developerdude
  • 9,118
  • 10
  • 57
  • 95
6
votes
2 answers

QSignalSpy can not be used with threads

I wrote a thread that executes a worker object. Everything works fine. Also the resulting signals are emitted as they should. Of course I took care of the usual mistakes regarding thread/object affinity. Today I wrote an automated module test for…
Silicomancer
  • 8,604
  • 10
  • 63
  • 130
6
votes
1 answer

How to use QTest QBENCHMARK macros result as a parameter in a unit test

I am writing some unit tests using QTest in Qt. I also encountered the QBENCHMARK macro, which benchmarks the code it encapsulates. I am running my unit tests and benchmarks some of the code. The QBENCHMARK reports how long it took to execute some…
uniquenamehere
  • 1,869
  • 3
  • 31
  • 60
6
votes
2 answers

QTest: It's possible to test drag&drop?

I try to test drag&drop with simple sequince: mousePress + mouseMove + mouseRelease. But it's not work. I investigate qtest source and found, that move event tested through main dispatcher processEvent(). Also I found some bugs in qt bug-tracker: 1,…
Aleksey Bakin
  • 1,506
  • 13
  • 27
5
votes
1 answer

QTestlib unit testing project to access the classes in the main project within QTCreator

I am using QT Creator and want to run my unit tests in a separate project. How do I reference the classes in the main project from my test project?
odie
  • 51
  • 3
5
votes
1 answer

PyQt5: mouseClick and source-code in QWebEngineView

I have a working script that uses PyQt-5.5.1, which I now want to port to a new PyQt version (5.7). Adapting most of the things was fine, but I faced two major problems: (1) to perform a (simulated) mouseclick, (2) to access (let's say: print) the…
nostradamus
  • 712
  • 12
  • 24
5
votes
2 answers

How to use QTest::mouseClick with QAction

I'm very new to Qt, and I need to simulate a click using the QTest Namespace and QTest::mouseClick. My problem is I would like to click a QMenu entry, defined as a QAction, but the mouseClick function doesn't allow me to pass this as an argument…
Fran M.
  • 79
  • 5
5
votes
2 answers

qWait analogue in PySide?

I've written a series of unit tests in PyQt using QTest and unittest. My code passes signals around, so to ensure that sufficient time has gone by after an operation before testing, I throw in some…
taynaron
  • 704
  • 1
  • 10
  • 23
4
votes
0 answers

How to run multiple tests in Qt without calling QTest::qExec multiple times?

I have a project with multiple independent libraries, and for each library I wish to create it's own test suite. I plan to have a single executable that links all suites, and to be able to run either all tests or a single test from the Qt Creator…
Dmitry Kuzminov
  • 6,180
  • 6
  • 18
  • 40
4
votes
3 answers

QTcpClient successfully connects, but not to my server. Where is it connecting?

I have successfully built a thin client/server using Qt's Tcp Sockets API. I know it works very well, because I have sent plenty of data over the wire and verified it. However, my project manager wants a suite of unit-tests, and I'm implementing…
dusktreader
  • 3,845
  • 7
  • 30
  • 40
4
votes
2 answers

How can I get access to a QMessageBox by QTest

I am creating some automated GUI tests in my application using QTest. I can access the widgets from my application using the command: savePushButton = mainWindow->findChild("savePushButton"); It is working fine, but now I have to…
KelvinS
  • 2,870
  • 8
  • 34
  • 67
4
votes
1 answer

mouseclick/keyclick not work for delegate widget inside treeview in QTest framework

I use itemdelegate to create combobox for one column inside a treeview. so when editing the cell, pressing UP/Down can change the value. But it seems I cannot simulate the operations below using qtest…
camino
  • 10,085
  • 20
  • 64
  • 115
4
votes
1 answer

How to see QTest results

I am using QTest of Qt 5.3.2 to execute some unit tests on a class. I am using VS2013 Express to build the tester. The VS project file is generated from a .pro file using qmake. For running the tests I added the QTEST_MAIN to my source file. The…
Silicomancer
  • 8,604
  • 10
  • 63
  • 130
4
votes
2 answers

QTestLib: Undocumented command line argument -chart

In Qt 4.6 QTestLib supports the command-line argument "-chart" (but this is undocumented). A report.html is created, however neither Firefox 3.6 nor IE8 are able to display anything but the headline "Test". When I look into the html-file it has some…
Simon
  • 1,616
  • 2
  • 17
  • 39
1
2
3
9 10