couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Couchdb Wiki] Update of "HowToCreateTests" by trogdoro
Date Thu, 23 Oct 2008 13:54:01 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification.

The following page has been changed by trogdoro:
http://wiki.apache.org/couchdb/HowToCreateTests

New page:
== Summary ==
This page focuses on how to create a test case for couchdb and run it.  Creating failing test
cases to identify a problem is a great way to contribute to couchdb.

== Context ==
 * You run the tests via clicking in your browser
 * The tests require the server to be running
 * All tests exist in one file:
  * (couch source)/share/www/script/couch_tests.js
  * tests are js functions and begin with: foo: function(debug)
 * Running tests this way may seem awkward at first
  * But the process is pretty quick
  * I can modify a test and see the results within a few seconds
 * This page assumes you've built couchdb from source

== To run the existing tests ==
 * go to: http://localhost:5984/_utils
 * click: Test Suite
 * click: the triangle button next to the test you want to run

== To create a new test ==
 * Go to: (couch source)/share/www/script/couch_tests.js
 * Either:
  * add lines to an existing test
  * create a new test in the 'tests' hash

== Steps to run your test ==
 * 1: Run this command from your couchdb source dir
  * sudo make install
 * 2: Run the tests in your browser
  * reload first
  * see 'To run the existing tests' heading above

== Example ==
I added these lines to the 'lots_of_docs' method, to make the test fail:

{{{
     // Check _all_docs with descending=true again (now that there are many docs)
     var desc = db.allDocs({descending:true});
     T(desc.total_rows == desc.rows.length);
}}}

Then I attached the diff to an existing Jira bug that described the issue.


== Ideas for future ==
 * davisp mentioned the idea of building a UI in futon
  * that will allow you to create/modify tests

Mime
View raw message