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
1
vote
0 answers

QTest::mouseClick RightButton can not work, can someone give some tips?

Recently, I saw a topic about QTest::mouseClick LeftButton(How can you edit a QTableView cell from a QTest unit test?),I trid it and succeeded. Now I need to simulate a RightButton-Click action and get the customContextMenuRequested, I used the same…
StephennQin
  • 81
  • 1
  • 5
1
vote
1 answer

Project Structure for unit testing (qtest) when using target_sources() command in sub directory

First of all, I know there are very similar questions in this forum. However, none really answer my specific case. I have the following project structure: |---Project_Root |---CMakeLists.txt |---build |---src | |---CMakeLists.txt …
glamis
  • 85
  • 9
1
vote
0 answers

Injecting a mock of a QTimer

I'm writing a unit test with QTest for a legacy code like: #include class MyObject: public QObject{ public: void foo(){ t1.start(500); } private: QTimer t1{this}; }; And want to mock a QTimer and…
Libor Tomsik
  • 668
  • 7
  • 24
1
vote
1 answer

Using slots in QTest - Test case or slot?

I am trying to build a test using qtest, to exercise my library which implements a class that wrapped QWebSocket. It looks like QTest will run every method under "private slots:" and thinks that it is test init, cleanup, or a test case. However, I…
Christopher Pisz
  • 3,757
  • 4
  • 29
  • 65
1
vote
1 answer

Qt creator and unwanted automatic prefix for a filename

How can I disable automatic "tst_"-prefix for a cc-filename, when creating unit test subproject in Qt creator? Thanks.
1
vote
1 answer

Robot framework: How to merge two xunit xml report files?

1.My robot file after running generates 4 files basically. output.xml, xunit.xml,report.html and log.html 2. After rerun,I want to merge the rerun generated report files with the old ones and obtain a new file. later,Xunit xmls are used to…
darshith mp
  • 13
  • 1
  • 3
1
vote
0 answers

How do I test the component given to the highlight property of a ListView?

I'm writing the tests of a component which looks something more or less like this: FocusScope { property ... id: root width: parent.width Component { id: focusMarker Item { z: 100 Rectangle { objectName:…
Manzana
  • 205
  • 4
  • 19
1
vote
0 answers

Does PyQt has support for QTest macros like QTRY_VERIFY

Does PyQt has support for QTest macros like QVERIFY and more importantly QTRY_VERIFY etc I've looked around but couldn't find it but maybe I'm overlooking something If not, what is the best way to support this functionality? I'd rather not use…
Marc Van Daele
  • 2,856
  • 1
  • 26
  • 52
1
vote
1 answer

qmltestcase can't find c++ class method

I have a simple application that runs successfully; however, I am having difficulties trying to run a test case with qmltest. From the documentation it shows to setup the main.cpp file with the QUICK_TEST_MAIN_WITH_SETUP call to initialize the QML…
slayer
  • 643
  • 7
  • 14
1
vote
1 answer

QObject::deleteLater is not called as expected in my Qt Test

I am testing a shared lib that contains a call to deleteLater internally. There is no event loop running inside the library so a requirement for the application is to have a event loop running, so that all memory is properly released. But in the…
Fryz
  • 2,119
  • 2
  • 25
  • 45
1
vote
1 answer

How can i terminate a delay / wait condition

I would like to know if there is any way to terminate a wait / delay condition. I am using QTest::qwait(ms) for adding responsive delay in my code. Now i would like to terminate/break this delay. Something like, QTest::qWait(2000) will start a 2 sec…
Manojjk
  • 41
  • 1
  • 5
1
vote
2 answers

QTest - Unable to pass Qt::Enter to QPushButton

I'm creating an automated test application using QTest Library. I'm able to simulate key presses on the application except when it gets to a window having QDialogButtonBox (Save, and Cancel). Here's my sample code: std::auto_ptr myForm(…
Owen
  • 4,063
  • 17
  • 58
  • 78
1
vote
1 answer

QT: unit-testing segmentation fault

Below is a code block for simulating key presses on a menu. I can navigate deep into the menus of my application but when I get back to the main form, I'm getting a segmetation error.... :( first I show my Application: std::auto_ptr
Owen
  • 4,063
  • 17
  • 58
  • 78
1
vote
1 answer

Qt UI testing : Can't perform QTest::keyPress

I have class MyForm which inherited from QMainWindow. Here's my code: std::auto_ptr pForm(new MyForm(3,3)); QTest::keyPress(&pForm, Qt::Key_0); However when I use QTest::keyPress on it, I'm getting: error: no matching function for call…
Owen
  • 4,063
  • 17
  • 58
  • 78
1
vote
0 answers

Separating data functions in Xunit format with Qt -xunitxml

I have several unit tests running in Qt 5 some with various data functions, but when I pass the results to Xunit format with -xunitxml flag I lose all the data that I had about the data functions. Is there a way to keep the data functions as…
Namox9001
  • 103
  • 3
  • 8