The goal of this project is to build a simple but sane testing harness for Javascript functions that participate in Riak Map-Reduce queries.
You must have Spidermonkey 1.8 or later installed (Riak currently uses 1.8rc1). This is easy to install on Mac OS/X with homebrew:
$ brew install spidermonkey
To create your own set of QC properties for your functions, use this template:
load("riak-qc-mapreduce.js"); load("your-functions.js"); // A property describe("Property for my function", // A descriptive string [gen1, gen2, gen3], // Generators for use in your property function(c, g1, g2, g3){ // invoke your function here, do some assertions on the result c.assert(true); }); Riak.QC.verify(); // Invokes the test runner
Some useful helper functions for assertions and generation are of the Riak.QC object.
To run more or fewer test cases, pass a new Config
object to Riak.QC.verify()
. To use as part of an automated test suite, pass the result of Riak.QC.verify()
as the first argument to quit()
, which will set the exit code non-zero on failure.
- Document helper functions
- Generators
- Riak objects – simple, with siblings, different formats
- Support invocation of Spidermonkey through erlang_js.
qc.js
comes from http://bitbucket.org/darrint/qc.js/