QtCreator doesn't recognize Qt Quick Unit Tests
Unsolved
QML and Qt Quick
-
I am trying to write QML unit tests in my Qt6 project. Here is my project structure:
| CMakeLists.txt | MyProject | - qml | - qml.qrc |- /qml |- MyButton.qml |- /test |- tst_mybutton.qml
MyButton.qml defines a RoundButton, nothing complex. The button is working as expected when I run my application.
Now I'd like to write a unit test to automatically test MyButton. Here is tst_mybutton.qml, which QtCreator initialized for me:
import QtQuick import QtTest TestCase { name: "MyButton" function test_onClick() { // TODO verify(true); } }
At the moment, this is just a stub. My problem is that QtCreator does not recognize this as a unit test. The test results tab is empty, and every option in the Tools > Test menu is greyed out (with the exception of "Rescan Tests", which doesn't seem to do anything).
Can someone please help me understand what's going on here? Why won't QtCreator run my unit test?