RE: A unit test story



On Mon, 2006-08-21 at 12:51 +0300, Dirk-Jan Binnema nokia com wrote:

Hey Dirk and others,

> Well, unit tests are valuable, definitely. *However*, this example
> shows that the danger of unit tests is also that they might not
> be complete. So... maybe the unit tests should be run in both
> the have-cache and don't-have-cache cases? Apparently those are
> different.

I'm making tests in directories tests/memory and tests/functional. They
will not immediately be unit tests.

There's a shared static library in tests/shared which (at this moment)
contains (for example) a simple account-store. That account-store can
for example implement functionality to use a /tmp/something.XXXXX
directory as cache store and remove that directory after use.

Feel free to implement something like this ;-). Note that the current
session-camel implementation will always start the cache folder from
$HOME (it concatenates it). This should probably be changed indeed.

That shared static library can be used by a unit test in
libtinymail-test too, indeed. Once somebody uses it for such a unit
test, just add the libtestsshared.a to the LDADD of libtinymail-test.

The account-store implementation will use an existing account on
mail.tinymail.org. Feel free to make this configurable (but keep that
account the default, as I'm planning to build some useful functional
tests that will check its results with that IMAP service).

> Another thing: the unit tests segfault / spew out warnings on
> my machine (amd/64). So... in other words: unit tests are not
> infallible... 

Absolutely. But let us use the instruments the God of thunder, torture,
destruction and programming has given us.

The fact that the unit-test spew that warning on your machine, and
didn't on my machine ... means that the unit test actually *did* help
with finding a problem that otherwise we wouldn't have found. Right?

Amen :-)

> Still, unit tests are useful, and I'll double-check the next time.
> But also, -Wall -Werror proved to be very useful to fix existing
> tinymail bugs. (eg. some non-void functions ended in 'return;'.)

Noticed those fixes. Thanks a lot.

> Anyway: great to see those ugly function die :-)

Yeah ;-)


-- 
Philip Van Hoof, software developer at x-tend 
home: me at pvanhoof dot be 
gnome: pvanhoof at gnome dot org 
work: vanhoof at x-tend dot be 
http://www.pvanhoof.be - http://www.x-tend.be




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]