You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Conor Mac Aoidh <co...@gmail.com> on 2014/07/27 19:54:06 UTC

Testing Views and Lists

Hi All,

Can anyone recommend a thorough method of testing couchdb view and list 
functions?

I'm using Jasmine to run tests atm and I have tried using mock-couch to 
emulate database behavior. However, AFAIK mock-couch does not support 
using list functions.

I just want to have a testcase that I can run to verify my view and list 
functions are working as expected.

Thanks

Conor

Re: Testing Views and Lists

Posted by Garren Smith <ga...@apache.org>.
If you are using javascript you could look at using Pouchdb to run a very simple preview of your functions.



On 01 Aug 2014, at 1:44 PM, Alexander Shorin <kx...@gmail.com> wrote:

> Hi,
> 
> Testing views/lists and others functions is simple, but currently will
> require some work from your side. Here is the plan:
> 1. You need a tool that implements query server protocol and
> communicates with it;
> 2. You need a middleware which will translate your function into ddoc
> (or takes yours one), pass it via query server protocol and return the
> result back in nicer form;
> 3. Finally, you need a target function/ddoc and challenges to apply.
> 4. Bonus: integrate all this with your favorite testing framework.
> 
> Hopefully, you don't need in first two points of this plan: you can
> try to reuse https://github.com/janl/couchdb-test-couchjs project and
> build your testing framework on top of it. And you'll be able to test
> your design functions without need to run CouchDB instance.
> 
> On other hand, you have alternative way to go by making tests inside
> couchapp and let CouchDB handle all the implementation details. To
> call the tests you only need to set some show function which will
> introspect the related design document, locate the tests, run them and
> print out result in nicer HTML page. As bonus you'll get self tested
> couchapps and verify their correctnesses in anytime you want.
> 
> --
> ,,,^..^,,,
> 
> 
> On Sun, Jul 27, 2014 at 9:54 PM, Conor Mac Aoidh
> <co...@gmail.com> wrote:
>> Hi All,
>> 
>> Can anyone recommend a thorough method of testing couchdb view and list
>> functions?
>> 
>> I'm using Jasmine to run tests atm and I have tried using mock-couch to
>> emulate database behavior. However, AFAIK mock-couch does not support using
>> list functions.
>> 
>> I just want to have a testcase that I can run to verify my view and list
>> functions are working as expected.
>> 
>> Thanks
>> 
>> Conor


Re: Testing Views and Lists

Posted by Alexander Shorin <kx...@gmail.com>.
Hi,

Testing views/lists and others functions is simple, but currently will
require some work from your side. Here is the plan:
1. You need a tool that implements query server protocol and
communicates with it;
2. You need a middleware which will translate your function into ddoc
(or takes yours one), pass it via query server protocol and return the
result back in nicer form;
3. Finally, you need a target function/ddoc and challenges to apply.
4. Bonus: integrate all this with your favorite testing framework.

Hopefully, you don't need in first two points of this plan: you can
try to reuse https://github.com/janl/couchdb-test-couchjs project and
build your testing framework on top of it. And you'll be able to test
your design functions without need to run CouchDB instance.

On other hand, you have alternative way to go by making tests inside
couchapp and let CouchDB handle all the implementation details. To
call the tests you only need to set some show function which will
introspect the related design document, locate the tests, run them and
print out result in nicer HTML page. As bonus you'll get self tested
couchapps and verify their correctnesses in anytime you want.

--
,,,^..^,,,


On Sun, Jul 27, 2014 at 9:54 PM, Conor Mac Aoidh
<co...@gmail.com> wrote:
> Hi All,
>
> Can anyone recommend a thorough method of testing couchdb view and list
> functions?
>
> I'm using Jasmine to run tests atm and I have tried using mock-couch to
> emulate database behavior. However, AFAIK mock-couch does not support using
> list functions.
>
> I just want to have a testcase that I can run to verify my view and list
> functions are working as expected.
>
> Thanks
>
> Conor