Unit tests in Frameworks

Kevin Ottens ervin at kde.org
Tue Dec 6 18:37:25 UTC 2011


On Tuesday 06 December 2011 18:45:38 Dario Freddi wrote:
> Hello everyone,
> 
> I know some of you are crying blood just by looking at the title, but
> yes, I want to bring this up :)
> 
> I think Frameworks could be a good chance to enhance and force
> requirements regarding unit tests, especially for new code. I am the
> first who apologizes as most of the code I committed to kdelibs didn't
> have unit tests at all, most of the times because the code itself was
> too hard to test (which of course is not a good excuse). AFAIK there
> is no policy (yet) in this regard; if we want to provide even better
> quality with our product, I think we should fix that.

What did you expect? I'm one of those unit tests evangelits, of course it's 
already in! :-)
http://community.kde.org/Frameworks/Policies#Frameworks_have_automatic_unit_tests

It's of course still somewhat lax because we're mainly dealing with existing 
code there. All new code and fixes should come with unit tests as much as 
possible.

> It would be nice to enable coverage through gcov (I already have some
> cmake code for doing that) and enforce a minimum percentage of
> coverage for each component, maybe dependent on the tier (Tier 1
> requires 90%, Tier 2 75%, etc...). Of course I know this is hard to
> apply to existent code unless people will do an effort, but I think it
> could be a sensible decision for future newcomers.

Making it dependent on the Tier is likely a bad idea, purely GUI frameworks 
will de facto see less coverage than something purely computational. It's 
likely to be another set of criteria for such threshold.

> What do you think about that? Is there an interest in applying
> something like that to our policies? In case, who would like to help
> me in drafting and implementing it?

More than a policy, what we need is first the infrastructure to get those 
metrics automatically. Otherwise it's pointless really, it's making empty 
statements.

Now, we already lined up an epic on that topic:
http://community.kde.org/Frameworks/Epics/Continuous_Integration

The page is still empty, but I'd advise you start to jot a couple of tasks in 
that regard, and having the necessary cmake magic in place to extract metrics 
is a good start. Policy should come last.

Also note that I think it'll be the right time to focus on that for 5.1, for 
5.0 we already have plenty to do with the existing code.

Regards.
-- 
Kévin Ottens, http://ervin.ipsquad.net

KDAB - proud patron of KDE, http://www.kdab.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20111206/25a4ea81/attachment.sig>


More information about the Kde-frameworks-devel mailing list