Results 1 to 10 of 10

Thread: QTestLib questions not covered by the manual.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default Re: QTestLib questions not covered by the manual.

    When I say "new project" in QTCreator, I get the choice of "GUI App", "Console App", or "Library". It uses it to set the TEMPLATE line in the project file. So sounds like the answer is "Console App".

  2. #2
    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: QTestLib questions not covered by the manual.

    There are really no differences between a "GUI" and "console" app. You can choose either of the two, especially as you can switch between the two by changing entries in the .pro file. The only difference is whether the QtGui module is included or excluded from the project and you will want that included if you are testing a graphical application.
    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. #3

    Default Re: QTestLib questions not covered by the manual.

    How do you run multiple test classes?

    I've got a directory structure like this:

    Qt Code:
    1. /proj
    2. proj.pro
    3. main.cpp
    4. /tests
    5. projtests.pro
    6. main.cpp
    7. /data
    8. data.pri
    9. dataclass.h
    10. dataclass.cpp
    11. /tests
    12. datatests.pri
    13. dataclasstests.h
    14. dataclasstests.cpp
    To copy to clipboard, switch view to plain text mode 

    Every dir has a /tests dir beneath it with tests, and main.pro includes data.pri whereas maintests.pro includes datatests.pri.

    The only thing is, I can't figure out how to run tests when set up like this?
    The tutorial says you have to do this in your test class:
    Qt Code:
    1. QTEST_MAIN(<test class name>)
    2. #include "<test class name>.moc"
    To copy to clipboard, switch view to plain text mode 

    But as far as I can tell, QTEST_MAIN creates a main function that tests that one class. I'm going to have multiple classes to test, and I want the test main function to live in /proj/tests/main.cpp.

    Also the #include "<name>.moc" always shows a warning in QtCreator that the file doesn't exist, although there is no compile-time error.

    How do you do this?
    Last edited by jeffadams78; 21st March 2009 at 13:46. Reason: fixing formatting

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.