couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Davis <>
Subject Testing CouchDB from Erlang
Date Sun, 31 May 2009 01:08:28 GMT

If you haven't noticed the commit message spam, I've started setting
up unit tests in Erlang for CouchDB. A quick run down on how to get
started on running them:

Step one: Download and install etap.

    $ git clone git://
    $ cd etap
    $ sudo make install

Step two: Run tests

    $ cd /path/to/couchdb
    $ ./configure && make check

This should make stuff as usual and then towards the end start
spitting out some test output. As an aside, this target relies on
having the prove command installed which comes with any Perl
installation. You can run the tests manually like such:

   $ prove test/etap/*.t
   $ prove -v test/etap/*.t  # for verbose style
   $ ./test/etap/001-load.t

The tests are all located in ./tests/etap/*.t and are individual
escript files. Each of these files can be run individually to produce
the TAP output that is consumed by prove. All tests are assumed to
have the working directory as the root of the CouchDB source

If you're feeling saucy you can also generate coverage reports like such:

    $ ERLC_FLAGS=+debug_info ./configure && make cover

This will create a directory ./cover/ that contains an index.html that
will point you at all the module coverage bits.

So far the tests only cover couch_file.erl, couch_btree.erl and
couch_doc.erl. I'd be very much interested in helping anyone that
wants to start learning CouchDB internals via testing. The more people
I can hoodwink^H^H^H^H^H persuade help write tests the faster we can
bring up our coverage.

Side note on Erlang compatibility:

Today with some help from bbrowning on #couchdb I went back and made
sure that all of the current tests are R12B compatible. As it turns
out, R12B's escript interpreter does not like things like -defines and
some other bits. Its more than likely that at some point in the
nearish future I'll end up dropping R12B support because of these
limitations. I haven't decided if that'll be before R14 or not though
and probably depends on how my frustration with it progresses. More
updates on this in the future.

Paul Davis

View raw message