Review Request 112681: Tests for KPluginTrader and friends

David Faure faure at kde.org
Mon Sep 16 09:59:05 UTC 2013


On Monday 16 September 2013 11:50:21 Sebastian Kügler wrote:
> On Sunday, September 15, 2013 08:42:31 David Faure wrote:
> > Data-driven tests *can* be run separately (and therefore qDebugs don't get
> > confusing), using the "methodName:rowName" syntax as command-line
> > argument.
> > 
> > Data-driven tests have the huge benefit that they reduce code duplication,
> > and they make it a lot easier to add new tests (which means people tend to
> > do it a lot more than with procedural tests).
> > 
> > I don't see which test "looks for a magic string in the plugin", in this
> > change request all methods except the last one could easily be factorized,
> > they perform the exact same steps with different data (and different
> > expected result).
> > 
> > If this was Qt I'm pretty sure you'd be required to convert it to
> > data-driven. But this is KDE, so I'll let you decide (now that you have
> > all
> > the data...).
> 
> I'm not sure I understand it well. Do you have an example?

Examples of data-driven tests? There are plenty

/d/kde/src/5/kdelibs-frameworks/kio/tests/kfileitemtest.cpp: 413: void 
KFileItemTest::testIconNameForUrl_data()
/d/kde/src/5/kdelibs-frameworks/kio/tests/kfileitemtest.cpp: 432: void 
KFileItemTest::testIsReadable_data()
/d/kde/src/5/kdelibs-frameworks/kio/tests/klocalsockettest.cpp: 72: void 
tst_KLocalSocket::connection_data()

or type "Data Driven Testing" in Qt assistant.

-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Working on KDE, in particular KDE Frameworks 5



More information about the Kde-frameworks-devel mailing list