Review Request 112681: Tests for KPluginTrader and friends
David Faure
faure at kde.org
Fri Sep 13 08:39:31 UTC 2013
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/112681/#review39943
-----------------------------------------------------------
staging/kservice/autotests/pluginlocatortest.cpp
<http://git.reviewboard.kde.org/r/112681/#comment29489>
this line does nothing
staging/kservice/autotests/pluginlocatortest.cpp
<http://git.reviewboard.kde.org/r/112681/#comment29492>
needs to be updated for the new argument order!
staging/kservice/autotests/pluginlocatortest.cpp
<http://git.reviewboard.kde.org/r/112681/#comment29490>
why not QCOMPARE(res.count(), 1), more precisely?
staging/kservice/autotests/pluginlocatortest.cpp
<http://git.reviewboard.kde.org/r/112681/#comment29491>
const QString constraint = ...
staging/kservice/autotests/pluginlocatortest.cpp
<http://git.reviewboard.kde.org/r/112681/#comment29494>
this should be data-driven.
The code is almost the same in all these findPlugin*() tests, only the input data (e.g. the constraint) and the expected result (0 or 1) changes -> create a _data() method with 3 columns (servicetype, constraint, expectedResultCount)
staging/kservice/autotests/pluginlocatortest.cpp
<http://git.reviewboard.kde.org/r/112681/#comment29493>
use QCOMPARE()
staging/kservice/tests/pluginlocator/CMakeLists.txt
<http://git.reviewboard.kde.org/r/112681/#comment29498>
Add a comment (on the same line) about why it's needed
staging/kservice/tests/pluginlocator/main.cpp
<http://git.reviewboard.kde.org/r/112681/#comment29495>
On the stack, and after the app.
staging/kservice/tests/pluginlocator/main.cpp
<http://git.reviewboard.kde.org/r/112681/#comment29496>
addHelpOption() is missing
staging/kservice/tests/pluginlocator/plugintest.h
<http://git.reviewboard.kde.org/r/112681/#comment29497>
Deriving from Q*Application is bad practice in apps (very unflexible, leads to all-in-one-class code). And there's no need to do that (you're not reimplementing any virtual methods).
OK it doesn't matter that much in a test, but I still don't like seeing it, it inspires other people to do it wrong.
This could be a simple QObject.
- David Faure
On Sept. 12, 2013, 3:35 a.m., Sebastian Kügler wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/112681/
> -----------------------------------------------------------
>
> (Updated Sept. 12, 2013, 3:35 a.m.)
>
>
> Review request for KDE Frameworks and David Faure.
>
>
> Description
> -------
>
> Tests for KPluginTrader.
>
> Under autotests/, there's a new test class which runs a variety of queries using KPluginTrader. There's also a small plugin, which is used to verify correct metadata querying and loading. It's not installed since QPluginLoader conveniently contains the working directory when looking for plugins -> it's found just fine.
>
> Under tests/, there's a test which will query for a variety of other plugins. This one is more geared towards performance testing. When run from make test, it will pass anyway.
>
> Code can also be found in kdelibs[sebas/pluginlocator].
>
>
> Diffs
> -----
>
> staging/kservice/autotests/CMakeLists.txt d341040
> staging/kservice/autotests/fakeplugin.desktop PRE-CREATION
> staging/kservice/autotests/fakeplugin.json PRE-CREATION
> staging/kservice/autotests/nsaplugin.h PRE-CREATION
> staging/kservice/autotests/nsaplugin.cpp PRE-CREATION
> staging/kservice/autotests/pluginlocatortest.h PRE-CREATION
> staging/kservice/autotests/pluginlocatortest.cpp PRE-CREATION
> staging/kservice/tests/CMakeLists.txt 3793aea
> staging/kservice/tests/pluginlocator/CMakeLists.txt PRE-CREATION
> staging/kservice/tests/pluginlocator/main.cpp PRE-CREATION
> staging/kservice/tests/pluginlocator/plugintest.h PRE-CREATION
> staging/kservice/tests/pluginlocator/plugintest.cpp PRE-CREATION
>
> Diff: http://git.reviewboard.kde.org/r/112681/diff/
>
>
> Testing
> -------
>
> make test =)
>
> All tests pass on top of my patches.
>
>
> Thanks,
>
> Sebastian Kügler
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20130913/54e077b8/attachment.html>
More information about the Kde-frameworks-devel
mailing list