Unit Tests

Andreas Pakulat apaku at gmx.de
Sat Sep 13 12:06:31 UTC 2008


On 13.09.08 10:51:58, M Breugelmans wrote:
> On Sat, Sep 13, 2008 at 3:20 AM, Andreas Pakulat <apaku at gmx.de> wrote:

> > I know and understand that writing tests might be boring (though I have
> > to admit that it can be fun too - try to think of it as an excercise on
> > breaking other peoples code), but I think if everybody tries to do a
> > little, we can already get quite some more coverage.
> 
> It is only boring if test are written after the code, because then
> it's a chore. Test-first is actually a lot of fun. It also leads (by
> definition) to testable code, low coupling, good api, instant
> feedback, a progress indicator, non-bloated code, high productivity
> and obviously few bugs. It does require a mentality shift and
> self-discipline though.

Yeah, I think the latter part is the most problematic for many of us :)

> > With that I think we might be able to increase the test coverage of our
> > code-base quite a bit.
> 
> Coverage is not the best metric, you can have 100% coverage without a
> single QVERIFY.

I didn't mean simple loc-coverage of function-call coverage. What I
meant is of course that the various "internal" constraints our code has
built into the source should be well covered.

> > Note that not only unit-tests on individual
> > classes are important, integration tests could also be useful.
> 
> Yea, units that behave correctly on their own are worthless if they
> don't cooperate correctly with the rest. Integration, subsystem and
> system tests fill that gap. Preferably automated (scripted?).

Unfortunately there's still no hardware available - AFAIK for
automatically running the tests. And yes, thats a KDE-wide problem
as not-running automated tests basically means they don't exist.

At least for kdevplatform and kdevelop I could probably setup an
automated build+test system on my workmachine - which basically does
nothing than consuming power during the night :) That one could then
also host and run the future GUI tests that I want to develop.

Andreas

-- 
It is so very hard to be an
on-your-own-take-care-of-yourself-because-there-is-no-one-else-to-do-it-for-you
grown-up.




More information about the KDevelop-devel mailing list