[RFC] KUnitTest library

Jeroen Wijnhout Jeroen.Wijnhout at kdemail.net
Thu Apr 7 15:12:20 BST 2005


On Thursday 07 April 2005 03:20 pm, David Faure wrote:
> > > Yes I would really like to have some unit test framework in kdelibs so
> > > that the unit tests there can all use the same framework.
> > >
> > > I haven't tested KUnitTest, but if the lib can be separated from the
> > > GUI, then let's have the lib in kdelibs and the gui in kdesdk. Would be
> > > nice to have a non-gui mode for "make check" though.
> >
> > It is not a problem at all to separate the two. Currently there are two
> > test-runner classes: KUnitTest::Runner and KUnitTest::RunnerGUI. The
> > Runner class is non-gui and all you need to run and review tests,
> > therefore suitable to use in "make check".
>
> OK. Please note that for this to work properly, the test code must be
> compiled as a dynamically-loadable module, and the executable from kdesdk
> must open it and run the tests inside.

KUnitTest could be changed to work like this, however right now you would have 
to link to the kunittestgui library to use the GUI, or just the kunittest 
library if you don't want the GUI. The way the unittests are registered is by 
static initialization of some helper objects, I'm fairly certain that you 
can't reliably do this with a module. 

Anyway, it would certainly be possible to modify KUnitTest in such a way that 
the tests can be loaded as modules. If you want to use this framework for 
kdelibs, then it would certainly be worth the effort. If you want to use the 
framework for testing a single app, it is a bit overkill. I will try to come 
up with something that will be useful for both use cases.

best,
Jeroen  
-- 
Kile - an Integrated LaTeX Environment for KDE
http://kile.sourceforge.net




More information about the kde-core-devel mailing list