My favorites | Sign in
Project Logo
                
Search
for
Updated Oct 06, 2008 by andybeeching
Labels: Featured, Phase-Design
About_qMock  

Our aim is simple, to make it the best JavaScript mocking framework out there, so other developers can lean on it to write better code. We have tried to keep the syntax itself as natural as possible (even meta?!), so that developers can concentrate on writing maintainable code, and not about the implementation.

Please feel free to download the source, check out the examples, put it through its paces and make any suggestions! So far we have implemented support for many common features of contemporary JavaScript programming, but there are also scenarios we couldn't have anticipated given the malleability of the language. We welcome all, and any feedback, or suggestions that can make the library better, and to improve integration with other test-harnesses in the wild. Encouragement and developer hugs/beer are also massively welcome!


Inspiration

qMock is loosely based on jMock & EasyMock (Java mocking libraries) but specifically addresses the needs of JavaScript programming and testing. The concept of mocking has been around since late 2000, but has only of late been applied to JavaScript (as has many other software engineering practices), in response to managing complex codebases.

qMock was written during our (Mark Meyer // Andy Beeching) tenure at Channel 4 Television, in response for the project requirement of automated testing of all JavaScript code on the site (using QUnit as our test harness). We are grateful to them for allowing us to open-source the project.


Compatibility

qMock itself has been developed in the TDD manner (frankly it would have been nigh impossible to so without it!), and as of writing works across all major, and most minor browsers. Basically, if stuff breaks, it shouldn't be qMock! :-)

Browsers include:


Features

qMock currently boasts:

and supports:

...and other basic mocking functionality.


Planned Features

  1. Adapters for Test Harnesses other than qUnit and YUI (e.g. JavaScriptMVC, jsUnit, Prototype/Mootools)
  2. Strict method call order flag
  3. Patterns library for easy copy-paste-modify testing
  4. Support for multiple callbacks with correlating arguments
  5. Better DOM element/reference collections support
  6. IDE integration - scriptDoc or jgrousedoc (Aptana only, textmate plugin anyone?)
  7. Custom Exceptions
  8. JSON input, mock output (quick mock creation, good for simple stubs)

Sign in to add a comment
Hosted by Google Code