Important: Please read the Qt Code of Conduct -

Questions about embedded test in Qt

  • Just started tests within Qt, read documentation, run few tests successfully, everything works. But i have few questions, hope there some people with experience of using Tests through Qt.

    1.) How to 'bind' tests with target project? I mean, my main project, and Tests - are independent projects, and i have to swap between them so often by clicking "set as primary object".
    2.) Got error: C1083: Cannot open include file: 'QMainWindow': No such file or directory after i tried to:

    #include "../TargetApplication/mywindow.h"

    I apparently did'nt add some command in my Test .pro, i'd say that problem arrives from #1.

    3.) Why there is no time counting in milliseconds for runned tests?) Or maybe it's just me, and my poor search skill.
    4.) Is it possible to make 'Test results' window float, so it could be moved independently on the screen. For example, would be useful to move it whole to the 2nd screen.

    P.S. i started with Google Tests(but i doubt that it matter in my case)

  • Lifetime Qt Champion

    @Engelard said in Questions about embedded test in Qt:

    Got error: C1083: Cannot open include file: 'QMainWindow': No such file or directory after i tried to

    How about adding "QT += widgets" to your test pro file?

  • @jsulm no changes, error still exist(cleaned, and run qmake after adding that in .pro)

  • Lifetime Qt Champion

    @Engelard Are you sure you cleared the test project?

  • @jsulm even reloaded whole framework, still "no such file or dir" thing.

    Few warnings btw, maybe they will give the hint:

    Project WARNING: Using googletest src dir specified at Qt Creator wizard
    "D:\Program Files\VS19\VC\Tools\MSVC\14.29.30037\bin\HostX86\x64\cl.exe" is used by qmake, but "D:\Program Files\VS19\VC\Tools\MSVC\14.29.30037\bin\HostX64\x64\cl.exe" is configured in the kit.
    Please update your kit (Desktop Qt 5.12.0 MSVC2017 64bit) or choose a mkspec for qmake that matches your target environment better.

  • Found. I was needed:

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    It worked for Qt Tests and Qt Quick Tests, still not working for Google Tests. I'm missing something, including other source files to the test is basic thing, it should'nt be such a problem...

  • Found similar problem on this forum, it is unsolved as well. It is silly, first thing what user do when creating Tests - including path to product project, and Qt Creator does not allow that, nonsense...

Log in to reply