I have been playing with Brian Kotek's ColdMock factory
(http://coldmock.riaforge.com) in doing some unit testing for an app I am
working on.  In this case, I have a service object that needs to retrieve a
record from the database via  a DAO.  I only want to test the service object
and not the DAO / database, so I am trying to use ColdMock to create a mock
DAO object that just returns a business object with some hard coded data.  

 

The problem is, when my service goes to ColdSpring and requests the DAO,
ColdSpring returns the mocked up DAO.  However, that mocked up DAO does not
contain any test data - in other words, if I call a function on that DAO, it
throws an error.  On Brian's site, he has code showing how to tell the mock
object what to return when a function is called, but I can't see how to work
that extra bit of code into the ColdSpring scenario.  When my service calls
ColdSpring to create the mock DAO, I would have to code in the extra
functionality at that point which is no good considering the service is a
real production object and should not know anything about a mock object.

 

Am I missing something here with regards to how mock objects work or should
function?

 

Thanks

-- Jeff



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Check out the new features and enhancements in the
latest product release - download the "What's New PDF" now
http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:293154
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to