Mock your db access.  Basically mock up the Dao objects to return the results 
you expect.

--Alex

> -----Original Message-----
> From: Anthony Xu [mailto:xuefei...@citrix.com]
> Sent: Monday, February 11, 2013 2:27 PM
> To: cloudstack-dev@incubator.apache.org
> Subject: how to write Unit test which requires DB setup
> 
> Hi all,
> 
> I'm trying to write some unit tests for network manager, I believe DB setup is
> needed and some pre-test DB initial entries are also needed. Is there any
> unit test frame work to setup DB and populate some initial data into DB
> before launching the unit test?  Or is there other way to mock DB access?
> 
> Your comment is highly appreciated!
> 
> Anthony

Reply via email to