Results 1 to 6 of 6

Thread: QtTest- how to conditionally include/skip tests?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    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: QtTest- how to conditionally include/skip tests?

    First of all it should be stated whether the condition should be checked during compile or run time.
    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.


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

    TorAn (3rd June 2017)

  3. #2
    Join Date
    Nov 2009
    Location
    US, Midwest
    Posts
    215
    Thanks
    62
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QtTest- how to conditionally include/skip tests?

    Sorry, it was not clear. During compile time. Currently I am just moving the test methods from slot specification to regular methods. Perhaps there is a better way.

  4. #3
    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: QtTest- how to conditionally include/skip tests?

    #ifdef might be a good way but I think moc doesn't obey ifdefs unless you explicitly pass them to it via a commandline switch. What you can do though is put the #ifdef in body of the test and add/remove a QSKIP macro.
    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.


  5. #4
    Join Date
    Sep 2017
    Posts
    1
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QtTest- how to conditionally include/skip tests?

    Yes, you can conditionally skip tests using the QSKIP macro. The following provides an example to skip the database test if there is no database connection:
    http://doc.qt.io/qt-4.8/qtest.html#QSKIP

Similar Threads

  1. QtTest: forced to #include .cpp file
    By Urthas in forum Qt Programming
    Replies: 1
    Last Post: 1st August 2015, 02:00
  2. how to skip to read particular line in a file
    By iswaryasenthilkumar in forum Newbie
    Replies: 3
    Last Post: 6th April 2015, 08:40
  3. Skip NaN values in qwtplot
    By ivareske in forum Qwt
    Replies: 0
    Last Post: 12th October 2011, 14:01
  4. Replies: 7
    Last Post: 30th May 2011, 09:34
  5. skip function parameter
    By mattia in forum General Programming
    Replies: 4
    Last Post: 22nd November 2007, 15:55

Tags for this Thread

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.