Butterfly Testing Tools
Butterfly Testing Tools is a collection of test tools for software testing.
The tools are:
Dynamic Mock Object Testing API (JUnit compatible)
The dynamic mock object testing API is similar to EasyMock, only
in our opinion it has a more straightforward interface, and
has stubs, mocks, *and* proxies. The dynamick mock object
testing API plugs right into your JUnit tests. EasyMock don't seem to have proxies.
We are not talking about java.lang.reflect.Proxy instances. EasyMock has
that as well. But mock-proxies for real collaborators, for instance a mock-
proxy wrapped around a real database connection, enabling you to assert
what methods were called on the real connection, through the proxy.
See examples here.
The dynamic mock object testing API supports:
The stubs and mocks follows
Martin Fowlers definition of stubs and mocks.
A Stub is an object that implements an interface of a component, but instead
of returning what the component would return when called, the stub can be
configured to return a value that suits the test.
A Mock is like a stub, only it also has methods that make it possible determine
what methods where called on the Mock.
Proxies are mock objects that delegate the method calls to
real collaborator objects, for instance to a real database connection.
Proxies make it possible to both test that a DAO class reads
the correct data from the database, and that the connection.close()
method is called correctly on the connection after reading. You can
also stub return values of the proxy. The return values will then
be returned instead of calling the real collaborator. You can switch
on the fly between real collaborator method calls and stubbed return values.
Back to Top