Results 1 to 4 of 4

Thread: How do you run multiple test classes?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,372
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How do you run multiple test classes?

    Posting the same question twice won't help. I have seen your previous post but to be honest I don't know what you wanted to achieve Usually if you want to have multiple tests, you do that through multiple executables or you don't use QTEST_MAIN but provide your own main() where you call QTest::exec() to trigger testing using a given class.

    I don't know if it answers your question but in case it does, here you are.
    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. #2

    Default Re: How do you run multiple test classes?

    Well, maybe it doesn't matter, since the same person always answers posts .

    To elaborate on what I'm getting at, I'm used to frameworks(junit, nunit) / IDEs(eclipse, VS) that will run "all" your tests (for a given project) in one go, even if they are in different libraries. I'm trying to do that with QT.

    So you're saying I need /proj/tests/projtests.pro to look something like this:
    Qt Code:
    1. QT += testlib
    2. TARGET = Tests
    3. CONFIG += console
    4. TEMPLATE = app
    5. SOURCES += main.cpp
    6.  
    7. include(../data/tests/datatests.pri)
    8. include(../foo/tests/footests.pri)
    9. include(../bar/tests/bartests.pri)
    To copy to clipboard, switch view to plain text mode 

    And then a corresponding /proj/tests/main.cpp like this:
    Qt Code:
    1. #include <QTest>
    2.  
    3. int main(int argc, char *argv[])
    4. {
    5. DataTests test1;
    6. FooTests test2;
    7. BarTests test3;
    8.  
    9. QTest.qExec(&test1);
    10. QTest.qExec(&test2);
    11. QTest.qExec(&test3);
    12.  
    13. return 0;
    14. }
    To copy to clipboard, switch view to plain text mode 

    Do I need to #include the .moc files in this case?

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

    Default Re: How do you run multiple test classes?

    qmake won't "run" anything for you. I'm using a simple script to do that.
    bash Code:
    1. #!/bin/sh
    2.  
    3. for i in 1 2 3 model
    4. do
    5. cd test$i
    6. ./test$i
    7. cd ..
    8. done
    To copy to clipboard, switch view to plain text mode 

    test1, test2, test3 and testmodel are my tests.

    You need to include "main.moc" only if there is a Q_OBJECT macro in the main.cpp file.
    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.


Similar Threads

  1. Object and multiple inheritance for interfaces
    By brcain in forum Qt Programming
    Replies: 8
    Last Post: 29th June 2021, 15:29
  2. Multiple Classes setText Update
    By Msnforum in forum Qt Programming
    Replies: 5
    Last Post: 30th January 2009, 15:40
  3. Professional Classes & Objects Structure
    By webstylemedia in forum Newbie
    Replies: 4
    Last Post: 4th August 2008, 10:50
  4. GUI version of test runner
    By Intaek Lim in forum Qt Programming
    Replies: 1
    Last Post: 17th April 2007, 10:21
  5. How to unit test a Qt Gui
    By mitskits in forum Qt Programming
    Replies: 1
    Last Post: 20th January 2006, 07:36

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
  •  
Qt is a trademark of The Qt Company.