[Qt-creator] Testing of own plugin

Eike Ziller Eike.Ziller at qt.io
Wed Jan 25 16:04:05 CET 2023


And when I've already written the code:

Plugins: Add documentation about testing
https://codereview.qt-project.org/c/qt-creator/qt-creator/+/456340

> Am 25/01/2023 um 12:24 schrieb Eike Ziller via Qt-creator <qt-creator at qt-project.org>:
> 
> Hi,
> 
> yes, you can use both.
> 
> A short description would be:
> 
> To add plugin tests, add private slots that start with "test" to your IPlugin implementation. These are looked for when you run Qt Creator with "-test <yourplugin>".
> Use these if you rely on the Qt Creator infrastructure to be available, e.g. if your test needs to interact with other parts of Qt Creator.
> 
> Otherwise use auto tests. You can use the add_qtc_test function if you want, though I'm not sure if that adds anything useful, but it will give you a similar interface as for plugins and executables.
> 
> I've added a few dummy tests to my example dummy plugin, as a reference for (one way of solving) the details, that uses the fact that add_qtc_plugin etc does some helpful things when WITH_TESTS is set:
> 
> https://github.com/e4z9/qtcreator-testplugin/commit/fa8065f580ee5724f8b9afb06e904e1be1c2e343
> 
> Br, Eike
> 
>> Am 25/01/2023 um 11:21 schrieb Knut Petter Svendsen via Qt-creator <qt-creator at qt-project.org>:
>> 
>> Hi!
>> 
>> I'm writing my own plugin and I want to add tests. I know that QtCreator
>> itself has a mechanism with adding tests via slots and WITH_TESTS. How can
>> I do the same for my own plugin?
>> 
>> Is this the best way to add tests, or can i add "normal" unit tests as well?
>> 
>> Regards,
>> Knut Petter Svendsen
>> 
>> 
>> 
>> <untitled-[2].html>_______________________________________________
>> Qt-creator mailing list
>> Qt-creator at qt-project.org
>> https://lists.qt-project.org/listinfo/qt-creator
> 
> _______________________________________________
> Qt-creator mailing list
> Qt-creator at qt-project.org
> https://lists.qt-project.org/listinfo/qt-creator



More information about the Qt-creator mailing list