Skip to content

seancribbs/riak-qc.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

riak-qc.js: Testing Riak Map-Reduce functions in Javascript

The goal of this project is to build a simple but sane testing harness for Javascript functions that participate in Riak Map-Reduce queries.

Dependencies

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

Usage

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.

TODO

  • Document helper functions
  • Generators
    • Riak objects – simple, with siblings, different formats
  • Support invocation of Spidermonkey through erlang_js.

Credits

qc.js comes from http://bitbucket.org/darrint/qc.js/

About

Test Riak map and reduce functions in Javascript, in a QuickCheck style

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published