Results 1 to 5 of 5

Thread: debugging a unit test

  1. #1
    Join Date
    Jan 2012
    Posts
    7
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default debugging a unit test

    Dear all,

    I am using Qt Creator 2.2.1 Based on Qt 4.7.3 (32 bit). There, I created a unit test using the File -> New File or Project-> Unit test. When I try to debug the unit test, I get a message in a popup window:

    This does not seem to be a "Debug" build.
    Setting breakpoints by file name and line number may fail.


    And the breakpoints are ignored, even though I specified it to be a debug build in the left lower corner of the QtCreator.

    I looked up the topic under http://developer.qt.nokia.com/doc/qt...ib-manual.html under Building a Test and got this suggestion:

    If you are using other build tools, make sure that you add the location of the QTestLib header files to your include path (usually include/QtTest under your Qt installation directory). If you are using a release build of Qt, link your test to the QtTest library. For debug builds, use QtTest_debug.

    Please, could you explain me what is meant under use QtTest_debug ? I really have no idea here.

    I tired:

    QT += QtTest_debug
    CONFIG += QtTest_debug

    with no effect.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: debugging a unit test

    Quote Originally Posted by Martin Drozdik View Post
    Dear all,

    I am using Qt Creator 2.2.1 Based on Qt 4.7.3 (32 bit). There, I created a unit test using the File -> New File or Project-> Unit test. When I try to debug the unit test, I get a message in a popup window:

    This does not seem to be a "Debug" build.
    Setting breakpoints by file name and line number may fail.


    And the breakpoints are ignored, even though I specified it to be a debug build in the left lower corner of the QtCreator.
    You need to explicitly rerun qmake and rebuild your project.


    If you are using other build tools, make sure that you add the location of the QTestLib header files to your include path (usually include/QtTest under your Qt installation directory). If you are using a release build of Qt, link your test to the QtTest library. For debug builds, use QtTest_debug.

    Please, could you explain me what is meant under use QtTest_debug ? I really have no idea here.

    I tired:

    QT += QtTest_debug
    CONFIG += QtTest_debug

    with no effect.
    You are not using "other build tools", this applies when you have to manually add linking to QtTest libraries.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    Martin Drozdik (20th January 2012)

  4. #3
    Join Date
    Jan 2012
    Posts
    7
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: debugging a unit test

    Thank you very much! It works!

  5. #4
    Join Date
    Sep 2011
    Posts
    6
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: debugging a unit test

    Having the same issue - but, the above "fix" is not working on 4.8.1.

    i don't find any reference to QtTest_debug anywhere in the Qt dirs...

  6. #5
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: debugging a unit test

    Thanks for your "It doesn't work" post... we'll just guess what you are doing.

    The issue in the original post is easily fixed by:
    • Tell QtCreator you want a debug build
    • Rerun qmake
    • Rebuild project

Similar Threads

  1. How can we make unit test for multithread in QT
    By learning_qt in forum Qt Programming
    Replies: 8
    Last Post: 15th January 2013, 16:09
  2. Problem with Qt Unit Test
    By rubikon in forum Qt Programming
    Replies: 3
    Last Post: 25th November 2011, 09:18
  3. Unit test coverage
    By leoalvesmachado in forum Newbie
    Replies: 3
    Last Post: 16th April 2010, 13:48
  4. Unit Test Organisation, and having qmake what I want
    By jrharshath in forum Qt Programming
    Replies: 1
    Last Post: 15th September 2009, 18:59
  5. How to unit test a Qt Gui
    By mitskits in forum Qt Programming
    Replies: 1
    Last Post: 20th January 2006, 07:36

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.