Results 1 to 2 of 2

Thread: QtTest Qt5 CMake

Hybrid View

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

    Default QtTest Qt5 CMake

    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
    Apr 2025
    Posts
    1
    Qt products
    Qt Jambi
    Platforms
    Symbian S60

    Default Re: QtTest Qt5 CMake

    Create and configure CMakeLists.txt for the project and test, link to the library containing the Calculatrice class. => create a test file in the tests/ folder, use QTest to write unit tests for the class Calculatrice => Compile and run the test via Qt Creator or command line with cmake and ctest => Check the test results to make sure all passed or there is error information that needs fixing.

Similar Threads

  1. qttest output
    By BalaQT in forum Qt Programming
    Replies: 3
    Last Post: 28th May 2011, 17:17
  2. Extending QtTest lib
    By davif in forum Newbie
    Replies: 5
    Last Post: 4th November 2010, 19:45
  3. Integrating QtTest with CMake
    By chiiph in forum Qt Programming
    Replies: 2
    Last Post: 28th October 2010, 11:36
  4. QTTest and my own gui
    By GrahamLabdon in forum Newbie
    Replies: 0
    Last Post: 19th March 2010, 10:26
  5. QtTest bug
    By graeme in forum Qt Programming
    Replies: 4
    Last Post: 19th February 2006, 21:16

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.