Create Qt Quick tests
Qt Creator integrates the Qt Quick Test unit test framework for Qt Quick applications, where you write test cases as JavaScript functions.
To create a Qt Quick test:
- Go to File > New Project > Test Project.
- Select Qt Quick Test Project > Choose.
- In the Project and Test Information dialog, specify settings for the project and test.
- In Test case name, enter a name for the test case.
- Select Generate setup code to execute C++ code before running any of the QML tests. The testing framework will call slots and invocable functions, as described in Executing C++ Before QML Tests.
- Select Generate initialization and cleanup code to add functions to your test that the testing framework executes to initialize and clean up the test.
- In Build system, select the build system to use for building the project: CMake, qmake, or Qbs.
Qt Creator creates the test in the specified project directory. Edit the .cpp file to add private slots for each test function in your test.
See also How To: Test, Select the build system, Testing, and Test Results.