Questions tagged [qttest]

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

Documentation can be found here.

81 questions
2
votes
1 answer

QtTest console application without x server

I have some unit tests for my project that I did with the QtTest framework. It is a console application, and actually I don't use anything from Qt apart from QtTest. On my computer it works fine, however I am setting up continuous integration on…
Jean-Michaël Celerier
  • 7,412
  • 3
  • 54
  • 75
1
vote
1 answer

Running Qt unit tests over SSH

I've written a number of unit tests for a Qt application using QTest which are packaged into a separate executable and can be run from a terminal. Both executables can be compiled and run fine from both my desktop and my Jenkins server. However,…
Ozmydis
  • 53
  • 4
1
vote
2 answers

Is there QMake analogue for ".." from bash?

I'm writing a unit test using QtTest framework. I have a .pro file representing test project where i want to specify a relative path to the source files i want to test with INCLUDEPATH keyword. The source files are in the source folder, which is 2…
George
  • 578
  • 4
  • 21
1
vote
1 answer

How to use QAbstractItemModelTester with google test?

I use googletest as the main testing framework for a Qt project. QAbstractItemModelTester helps catching the most common errors in custom item model classes but I don't know how to integrate the reported failures(QTest) in a googletest unit test.
adrian
  • 31
  • 2
1
vote
0 answers

QT Test Main Multiple Definition, but using that macro for application creation

I am trying to create a new test class for each of my classes in QT. I have this working with a single file, but that relies on QTEST_MAIN creating an application for me and calling it in more than 1 file creates a multiple definition error. I…
Yeet
  • 92
  • 7
1
vote
1 answer

How to generate mouse click on QGraphicsWidget in QTest?

I want to test the functionality of pressing a button from my panel. The problem is that the button is not QPushButtons, but rather QGraphicWidget elements. How do I generate this button mouse-click to test its behavior? Buttons are not simple…
siadajpan
  • 55
  • 6
1
vote
1 answer

QtTest: prevent executable from being copied to system

So, there I'm writing some library and desided to have a proper unit-testing for it (like TDD and so on). QtTest framework looked suitable to start with. The library itself is fine, so is the test. But when I added both the library and the test…
MasterAler
  • 1,614
  • 3
  • 23
  • 35
1
vote
0 answers

How to access and test private widgets of a Qt window from Qt Test unit testing class?

I am trying to unit test (using Qt Test) the individual widgets in a Qt Widgets application, like menuBar, pushButton, etc. The project has been set up as a Subdirs project, where the both the Qt application and GUI test sub projects have their own…
pusrob
  • 81
  • 7
1
vote
0 answers

Receiving fatal error assigning QSharedPointer in QtTest

In TestGroup_Person, when I retrieve a QSharedPointer<-JB_TableRowProt> from JB_PersonDao and assign it to QSharedPointer<-JB_TableRowProt> aGroup_Person (in .h), I then get this error in the methods of TestGroup_Person. Alternatively, if I retrieve…
Jeff
  • 95
  • 9
1
vote
1 answer

Qt Test: error symbol(s) not found when instantiating object in test project

I'm sure I'm just missing something in my original class (conferenceview), but I can't wrap my head around exactly what is missing. When I attempt to build my tst_conferencepage.cpp file, which includes my conferenceview class, I get an error…
1
vote
0 answers

QtTest QBenchmark print all run times

I'm running benchmarks in my tests with the QBENCHMARK macro. I pass the iterations n and -o myfile.csv,csv flags to the executable. Unfortunately, Qt only gives you the average run-time, accumulative run-time and number of runs. I'd like to have…
Benjamin Maurer
  • 3,602
  • 5
  • 28
  • 49
1
vote
1 answer

Travis CI Qt Test Integration

Travis relies on the exit code on an executable to determine if the test passed or failed. Qt Test is designed so that every test class is contained in its own executable so, after the build, I end up with a bunch of tests inside my bin/tests…
IlBeldus
  • 1,040
  • 6
  • 14
1
vote
0 answers

Qt Creator: run unit test automatically before main project

I have some widget application project on Qt 5.9.3. Now for a Unit testing I've created a new root "subdir" project, which contains my main application project and the new Qt test project: Notice - how I create the root solution folder with an…
Vladimir Bershov
  • 2,701
  • 2
  • 21
  • 51
1
vote
1 answer

QListWidget doesn't recognize signals from QTest::mouseDClick

I am trying to use QTest to test UI interactions with a QListWidget. Interactions made from a simple click work fine (QTest::mouseClick()) but interactions from a double click do not (QTest::mouseDClick()). Here is simplified code sample to…
Mickaël C. Guimarães
  • 1,020
  • 2
  • 14
  • 32
1
vote
1 answer

Declare unsigned char[] with Q_DECLARE_METATYPE

I'm trying to set up some unit tests with QtTest and i'd like to use QFETCH. I am testing the following function : static std::vector FrameHandler::getBitsFromFrame(unsigned char* data, unsigned char length); It simply converts a array of…
Xatyrian
  • 1,364
  • 8
  • 26