DMocks: Mock Objects for the D Programming Language
DMocks is a framework for mock objects patterned after Rhino Mocks. Mock objects simplify and improve unit testing by allowing you to test one class at a time, independent of any dependencies or referenced classes.
DMocks only supports recent versions of DMD 2. It is thus both a problem in search of a solution (mocks for DMD1) and a solution in search of a problem (people using an experimental compiler aren't quite as likely to use TDD, I think). But the supply is there, awaiting the demand!
DMocks is licensed under the BSD license. If you need it in a different license for some reason, talk to me -- dhasenan at gmail dot com.
Status
As of 26 February, you should be able to mock any interface or (non-final) constructorless class. See Caveats for details.
Starting Points
- Downloads -- Getting dmocks (or, just get the current version)
- BriefUsage -- if you are familiar with mock objects and just want a quick guide to dmocks
- Examples -- Example usages of mocks. This should be a good introduction to both DMocks and mock objects in general.
- Caveats -- Things to keep in mind when using mock objects
- FuturePlans -- What will happen with regards to DMocks
News
- 2008-Feb-28: released version 1, with a new numbering scheme, which works with dmd2.011 and fixes a number of bugs.
- 2007-Dec-02: released version 0.92, updated for dmd2.008 with workaround for bug 1711
- 2007-Nov-12: released version 0.91, which fixed some really stupid bugs that prevented mocking of classes with no default constructor and prevented mocking interfaces.
- 2007-Nov-11: released version 0.9. Supports OrderedExpectations and Allowing (equivalent to Rhino's SetupResult.For).
- 2007-Nov-10: released version 0.3. Supports mocking any class, regardless of constructor; supports PassThrough option.
For a list of local wiki pages, see the Index.
