When our code interacts with other classes through methods and attributes, these are referred to as collaborators. Mocking out collaborators using mockito (http://code.google.com/p/mockito and http://code.google.com/p/mockito-python) provides a key tool for BDD. Mocks provide a way for providing canned behavior compared to stubs, which provide canned state. While mocks by themselves don't define BDD, their usage keenly overlaps the ideas of BDD.
To further demonstrate the behavioral nature of the tests, we will also use the
spec nose plugin found in the pinocchio project (http://darcs.idyll.org/~t/projects/pinocchio/doc).
For this recipe, we will be using the shopping cart application shown ...