Popcorn - a DSL for JSON


Project Description

Popcorn is a JavaScript embedded DSL designed for quick, ease and flexible JSON object generation. The core modules provides a basic set of generators for most common JavaScript types, and combinators to build new generators for any kind of data. Additional modules extend the functionality with random generators, dictionaries, network type generators for IP or mac address and more.

Main purpose of this framework is mock object generation for testing of JSON services and browser side JavaScript code. Since with this DSL thousands of test cases can be expressed in just few lines of code, it makes for a great driver for data-driven test engines.

Quick start:

 with({ core: Popcorn.Core, 
        comm: Popcorn.Common }) { // Load other modules as needed.

   var base_object = { // Define the base object.
     id : 1, 
     name : 'Woody'
   };
 
   var generator = { // Define the generator object.
     id : core.range(10, 20),
     name : comm.list('Buzz', 'Slinky')
   };
 
   // And run it!
   var results = core.generate(generator, base_object);
 }
 

Authors:
Adam Smyczek
Brian Wilkerson
Version:
Generated on:
Wed May 05 15:30:43 PDT 2010