You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by Paul Davis <pa...@gmail.com> on 2009/05/31 03:08:28 UTC

Testing CouchDB from Erlang

Hey,

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://github.com/ngerakines/etap.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
directory.

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

Re: Testing CouchDB from Erlang

Posted by Paul Davis <pa...@gmail.com>.
On Sun, May 31, 2009 at 4:13 AM, Jason Davies <ja...@jasondavies.com> wrote:
> Nice work Paul!
>
> On 31 May 2009, at 02:08, Paul Davis wrote:
>
>> Step one: Download and install etap.
>>
>>   $ git clone git://github.com/ngerakines/etap.git
>>   $ cd etap
>>   $ sudo make install
>
>
> For the archives, this should actually be: $ make && sudo make install
>
> It might also be useful to have a more helpful error message e.g. "You need
> to install etap" when etap isn't installed.
>

Doh! Yeah, I should be able to get this easily enough. I'll add it to the list.

> Cheers,
> --
> Jason Davies
>
> www.jasondavies.com
>
>

Re: Testing CouchDB from Erlang

Posted by Jason Davies <ja...@jasondavies.com>.
Nice work Paul!

On 31 May 2009, at 02:08, Paul Davis wrote:

> Step one: Download and install etap.
>
>    $ git clone git://github.com/ngerakines/etap.git
>    $ cd etap
>    $ sudo make install


For the archives, this should actually be: $ make && sudo make install

It might also be useful to have a more helpful error message e.g. "You  
need to install etap" when etap isn't installed.

Cheers,
--
Jason Davies

www.jasondavies.com


Re: Testing CouchDB from Erlang

Posted by Paul Davis <pa...@gmail.com>.
On Mon, Jun 1, 2009 at 2:29 AM, Kevin Jackson <fo...@gmail.com> wrote:
> Hi,
>> 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.
>
> Coverage reports would be nice to include in the _utils interface.
> Would it be possible to kick off the etap unit tests from the _utils
> interface itself and then display /cover/index.html?
>

While not impossible, I'd probably lean towards including coverage
reports as part of a build bot run. Collecting the coverage data
incurs a fairly hefty overhead so I don't know that allowing people to
turn that on would be a good thing.

> Kev
>

Re: Testing CouchDB from Erlang

Posted by Kevin Jackson <fo...@gmail.com>.
Hi,
> 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.

Coverage reports would be nice to include in the _utils interface.
Would it be possible to kick off the etap unit tests from the _utils
interface itself and then display /cover/index.html?

Kev