[Interest] Issue with Unit Testing in Qt Quick Test - Undefined Method Error

Poonam Sangale sanglepoonam123 at gmail.com
Mon Mar 11 18:12:22 CET 2024


Hi Team,

I hope this email finds you well. I am writing to address an issue I have
encountered while writing unit test cases using Qt Quick Test.
Specifically, I am receiving a warning for methods that are being called
from QML to C++.

To provide a clear understanding of the issue, let me explain the project
structure. I have a unit test project that is separate from the main
project. In this unit test project, I am writing test cases to validate the
functionality of a button in a QML file. When the button is clicked, a
method in the C++ code is called. However, during the execution of the test
case, an error is displayed indicating that the method is undefined.

To resolve this issue, I have added the necessary context property in the
main.cpp file of the unit test project. Despite this, the error regarding
the undefined method is still persisting.

Based on the information provided, I would like to confirm whether the Qt
Quick Test framework supports writing test cases for QML files that call
C++ methods. It would be greatly appreciated if you could clarify this
matter and provide your expertise on the subject.

If the Qt Quick Test framework does not inherently support such test cases,
I would like to explore alternative solutions or workarounds that can
facilitate the testing of QML files that involve interactions with C++
code. Any guidance or suggestions you can provide in this regard would be
highly valuable.

Thank you for your attention to this matter. I look forward to your
response.

Best regards,
Poonam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20240311/9ba949ea/attachment.htm>


More information about the Interest mailing list