This project is read-only.
Summary Description
A framework that dynamically generates stub objects for your classes to support creating unit tests structured according to the 3A pattern (arrange/act/assert). Also supports refactoring (no string identifiers) and does not require interfaces.

Why a stub framework versus a mock framework?
Unit tests are a way of life for my development activities, but some things have always bugged me about mock object frameworks:
  • They do not support using the 3A pattern (Arrange/Act/Assert) because both the Expect and Record style syntax effectively means specifying your Assert criteria in your Arrange.
  • The Record or Expect syntax never seemed intuitive or easy to read to me.
  • Some mock frameworks require an interface to mock a class.
  • Some mock frameworks use string identifiers which prevent using refactoring tools.
I prefer using stubs over mocks, but got tired of hand creating my stub code so eventually got tired enough to roll up my sleeves and create a framework that suits me.

What does unit test code look like using the Attach Stub Framework?
Here is the examples page.

What is the difference between a stub and a mock?
Here is a link to Martin Fowler's paper "Mocks Aren't Stubs" which provides a detailed explanation of the difference (he prefers the stub approach as well).

What else?
That's it. Pretty straightforward. It works well for how I like to do unit testing, and so here it is for others who have similar preferences.

Last edited Jul 21, 2007 at 2:11 AM by jwanagel, version 11