In order to be able to better discuss Mock Objects vs In-Container, etc ...
I'd like to try to categorise ways of testing.

The first definition that we need to agree on is that of Mock Objects which
must not be mixed with Stubbing.

Mock Objects vs Stubbing :
- Mock Objects (as defined in
http://www.sidewize.com/company/mockobjects.pdf) which are used to finely
unit test a given method by isolating it from it's surrounding (this is done
by mocking all manipulated domain objects).
- Stubbing, which is what you describe. It can be used in several different
places, to mock java beans in order to easily unit test JSPs for regression.
It can also be used for example to mock an EJB so that you can unit test
your presentation objects, ...

Then, I would categorise testing into 4 different areas :
1- fine-grained unit testing, which is what Mock Objects do. This only unit
tests method by method without testing object interaction,
2- coarse-grained unit testing, which is what Cactus does for example. The
unit tests encompass domain objects and test interactions. Stubbing should
also be categorised into this category.
3- end to end tests, some kind of functional tests but whose goal is not to
test a complete functional use case which might involves a user interaction
over several screens for example. Rather it tests from end to end on a
technical feature, like testing that a JSP effectively returns the bank
account figures.
4- acceptance tests or full functional tests, which test the real user
testcase, ie. for example, the user fills a form, then if it does not enter
the postcode, such page with such error appears, ...

Do you agree with this classification ?

Thanks
Vincent.

Reply via email to