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

Avoid attaching debugger in Qt5 QTest

I have a small QTest case that crashes. Even if I run this as a normal program (no debugger) it seems that GDB is attached by qmake/QtCreator/something when it finds that the program crashed. However, I would like to run my QTest without this…
Mr. Developerdude
  • 9,118
  • 10
  • 57
  • 95
0
votes
1 answer

QT: When to use QT::keyRelease

I'm writing a test app that tests another application with a bunch of menus. I simulate keyPresses by using QT::keyPress. However, at some point it doesn't accept keyPresses anymore, until I learned you need to use keyRelease as well (according to…
Owen
  • 4,063
  • 17
  • 58
  • 78
0
votes
1 answer

QT unit-testing : qtestlib Segmentation fault

I'm writing a test app that would test if the displayed form is the correct form. This is after pressing a key on a menu. Here's a code block where I'm getting a segmentation fault. std::auto_ptr pForm(new MyForm(3,3)); …
Owen
  • 4,063
  • 17
  • 58
  • 78
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
0
votes
0 answers

Inheriting unit tests and testing constructors

I am using QTest but this issue is, in my opinion, more general than simply QTest specific. Suppose we have a simple class: class Number { Number() {} Number(int i) : m_Value(i) {} int value() const { return m_Value; } private: int…
Resurrection
  • 3,916
  • 2
  • 34
  • 56
0
votes
1 answer

QTest - writing tests for Qt-based library and exposing classes

I have a library (let's call it MyLib) which has the following structure: mylib_global.h - determines whether a Q_DECL_IMPORT or Q_DECL_EXPORT is behind the MYLIBSHARED_EXPORT prefix which is used to expose specific symbols of the library when…
rbaleksandar
  • 8,713
  • 7
  • 76
  • 161
0
votes
1 answer

Qtestlib log window

I link my program against the qtestlib and include QTest. But then I get a log-window which prompts all the qDebugs, when the application starts even if I set the configuration to release or debug. Is it possible to include QTest without opening a…
Manojjk
  • 41
  • 1
  • 5
0
votes
0 answers

How can I get the QMenu and QActions from a QwtPlot

I have a QwtPlot widget that shows a QMenu with some QActions when the user clicks on it with the right mouse button: Now, I need to implement an automated function to test it. How can I get access to the QMenu and QActions from the QwtPlot…
KelvinS
  • 2,870
  • 8
  • 34
  • 67
0
votes
1 answer

can I check the gtest_filter from inside a non-gtest test?

I have a test suite written in QTestLib. That's legacy. The QTest tests are invoked from a main method initialized like a regular gtest suite. On the CI server we invoke regular gtests with a 'time sensitive exclusion' filter like > testsuite.exe…
xtofl
  • 40,723
  • 12
  • 105
  • 192
0
votes
1 answer

QTEST_MAIN doesn't use provided Testclass

I want to do a performance test on threads and their interactions (e.g. shared data). To achieve this, I tried the Qt provided Tutorial for Benchmarks, which lead me to write the following code. The Benchmark-Class: class Bm : public QObject { …
FruitSokrat
  • 105
  • 9
0
votes
1 answer

QT close window by QTest in locked thread

I have a QT application and I want to test it with QTest. Shortly about what I wanna do: I have a Main Window, where the button Settings is located. If I click on this button, the QDialog is appeared. I want to test if this really happens MainWindow…
GriMel
  • 2,272
  • 5
  • 22
  • 40
0
votes
1 answer

qtest: No rule to make target error when compiling test

I have been working through creating a unit test. I need to learn this to test our gui objects. So far this site has answered many questions (most were asked and answered previously). However, I am now at a point where I am getting an error and I…
jolema
  • 41
  • 1
  • 5
0
votes
0 answers

QTest and .pro workflow

This is my (very simplified) directory tree : C:. | common.h | QMelt.pro | +---src | +---app | | main.cpp | | melt.cpp | | melt.h | | | +---io | | alsfilestreambase.h | | …
Bastien
  • 994
  • 11
  • 25
0
votes
1 answer

Access native QFileDialog

I'm writing a ui test for a Qt application. Now this application raises a QFileDialog which must be automatically filled in and committed. I already have a QTimer which runs even when the modal dialog is shown. This approach works for many dialogs…
Thomas Klier
  • 449
  • 4
  • 16
0
votes
2 answers

QTest implementation

How can I use the QTest::setBenchmarkResult method? I want an example of it. I have used this code: QBENCHMARK{ // Some code here ... } I want to catch the result of the benchmark and with a especific metric.
lumurillo
  • 31
  • 3
1 2 3
9
10