-
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
-
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.