jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Magnus Grimsell" <magnus.grims...@idainfront.se>
Subject SV: Mock objects with Cactus
Date Wed, 09 Mar 2005 14:16:35 GMT
I am using Junit and jMock for unit tests and Cactus for integration tests. 
However I dont think you want to refactor your unit tests to become integration tests. You
should have both to test different things.

As you said I write unit tests that tests the logic of individual classes. Then when I integrate
I write more coarse grained tests that really should test the integration between modules
and infrastructure.

Take an ejb as an example. The ejb:s logic is implemented in a number POJOS. These all have
unit tests. Some POJOS might interact with a data access layer or other infrastructure but
this is mocked. At the top we have a integration test that uses the ejb:s api to assure that
the module works together in its correct environment.

Magnus Grimsell

> -----Ursprungligt meddelande-----
> Från: Dawson Mossman [mailto:dawson.mossman@bulletproofsi.com]
> Skickat: den 9 mars 2005 15:01
> Till: Cactus Users List
> Ämne: Mock objects with Cactus
> 
> 
> Hi Vincent,
> I am fairly new to Cactus and am trying to understand exactly how it
> should work.  
> 
> Our organization wants to perform code logic unit testing and
> integration testing (we'll worry about functional testing later).  For
> our code logic unit testing, we are planning on doing JUnit tests with
> Mock objects.  
> 
> This is the strategy I am thinking we could use:
> 1) As we develop individual classes we will write JUnit tests 
> using Mock
> objects to test class methods.
> 2) Then, as we begin to integrate components (classes), we 
> will take the
> existing JUnit Tests, convert them to Cactus tests and use the real
> objects (not the Mocks).  This will give us our "in-container"
> integration tests.  
> 
> Does this sound like an appropriate approach?  Should I be doing
> something different?  Our environment will be using Web Services and
> EJB.  Will I be able to perform my code-logic unit tests outside the
> scope of a container, or will these need to be run in the same fashion
> as Cactus tests (ie. in container)?
> 
> Figuring out some of these questions would be great in 
> understanding how
> we can best use Cactus.  Thanks for any help you can provide.
> 
> Dawson
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: cactus-user-help@jakarta.apache.org
> 
> 

Mime
View raw message