Results 1 to 2 of 2

Thread: Qt

  1. #1
    Join Date
    Jul 2020
    Posts
    5
    Qt products
    Qt5
    Platforms
    Windows

    Default Qt

    Hi,

    I'm using Qt Creator 13.0.1, Qt5 and CMake 3.14.

    I want to create unit tests with QTest on the "Calculatrice" class that I created.

    I saw several Youtube videos and searched a lot on the internet but I couldn't find how to create a test.
    It seems that the solutions I found apply to old versions of Qt but nothing on the new version, even the examples on the Qt site are not detailed on the different steps.

    I tried two ways to create a test :
    1- After creating my "Calculatrice" class, I created a new project "File>>New project>>Test Project>>Qt Test Project", but I did not find how to connect this new test project to my "Calculatrice" class in CMake or elsewhere.
    2- After creating my "Calculatrice" class, I create a new subfolder in the same project and I create a CMake for the test.

    Neither method worked

    What is the correct method to create a test with QTest and what are all the steps to create a test??

    Thks

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,366
    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: Qt

    Qt test suits are regular applications therefore you need to add a new executable target to your project, link it with Qt's test library and either implement the main function according to the docs, or use a QTEST_MAIN macro to generate a main function.
    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.


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.