About

JSMock is a fully featured Mock Object library for JavaScript that provides the necessary tools to do effective interactive based testing.

JSMock provides expectation recording and matching, and has the ability to return, throw, and stub on object method calls. The interface is simple and easy to use, which makes testing easy.

Compatibility

JSMock has been tested with:

  • Internet Explorer 6.0
  • Mozilla Firefox 1.0+
  • Safari 1.5+

Note: Internet Explorer cannot mock out window or document objects.

News

  • 05/20/2007 - Released JSMock 1.2.1 Fixed verification bug that would give bad discrepancies thanks to a bug report and fix by Szczepan Faber
  • 02/24/2007 - Released JSMock 1.2 JSMock can be mixed into a testcase, added a resetMocks method

Todo

  1. Support matching object literals, this is direly needed
  2. Add robust debug messages on failures
  3. Add support for mock ids

Contact

Justin DeWind <dewindj@gmail.com>

Downloads

Download from Sourceforge.
Download the js file.

Sourceforge