couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Lehnardt <...@apache.org>
Subject Eunit
Date Tue, 10 Feb 2009 16:52:25 GMT
Hi,

the previously mentioned stats patch introduces EUnit*-style unit
tests for Erlang code. I believe this is useful for the rest of CouchDB
as well. There is a simple test runner in test/ that includes a few
tests for the couch_config* modules but that was never meant to
be a permanent solution.

* http://svn.process-one.net/contribs/trunk/eunit/doc/overview-summary.html


EUnit is the de-facto unit testing tool for Erlang applications and
it is even included in the latest distributions of Erlang/OTP. It's
far from perfect, but I think CouchDB would benefit from adapting
it, to gain and encourage writing standardized test cases for
CouchDB modules.

The one caveat with EUnit is that it is released under the LGPL.
I am not a lawyer but the consensus on "The Net" is that writing
test-cases against the EUnit API and conditionally including
eunit.hrl to include the API does not mean that the test code itself
must be released under the terms of the LGPL. If anyone is
familiar with this, can you comment on whether this is correct?

Technically, the EUnit tests for each module can be in the same
file as the module's functions or in a separate directory. I'd opt
for separating tests into their on directory, but I don't feel strongly
about it.

The tests should not interfere with production code. For this reason,
there is a compile-time switch to enable tests. We can wire this up
to `make test` so that EUnit-enabled CouchDB modules are built
locally and then tested. For `make install`, the compile-time switch
to enable tests would be off.

Some modules have a few tests inline, once we would have the
EUnit infrastructure in place, it'd be a good idea to modify the  
existing
test to fit in.

Permitted that there are no licensing issues, is there anything that
would speak against adding EUnit tests to CouchDB?

--

For now, the EUnit patch is entangled in the statistics patch, but
we could separate that into its own. Would that be something that
the community is interested in? Also, somebody please clear the
legal issue :)


Cheers
Jan
--


Mime
View raw message