incubator-cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Prasanna Santhanam <>
Subject Re: [DISCUSS] Concerns on testing and improvements
Date Thu, 31 Jan 2013 11:54:36 GMT
On Thu, Jan 31, 2013 at 10:53:20AM +0530, Mice Xia wrote:
> Prasanna:
> 2) More and more requests from contributors on how to write
> unit-tests show up on our lists every week.
> I agree we need more unit tests. At this moment there isn???t much
> detailed guideline or material about how to write a unit test with
> unified style.
> For example, before 4.1.0, mocks are injected with
> MockComponentLocator and these mock objects must be implemented
> manually. Later we bring mockito back and simplify the test codes.
> Now with spring being introduced, should we also use spring test
> framework?

> And for different layers, the way to implement unit tests might be
> different, to test a Resource class, we need a lot of mocks/stubs of
> external library; to test a DAO, should we prepare the database with
> test data?
> I think we need some consensus on ' what should be unit tested' and
> 'the recommend way to write a unit test'.

Several folks have asked me on how to write the unittests and to be
honest I've had only minor success with mockito for some basic tests
involving a class or two. My java handicap is a further bummer. And it
gets customized often for the scenario. For eg: it seems easier to
test the contract of the AWSAPI piece than test it using
mockito/mockcomponentlocator/junit. Edison emailed about the
integration tests and unit tests done for javelin which will be
merged to master. I haven't tried it personally but it looks like
javelin had good success with it.

CloudStack didn't evolve with unittests hand-in-hand and will need
some time, I expect, to fall in to that habit. In my (meagre)
experience I find it's harder to write unittests around developed code
than to write them for a project starting from scratch.

> 4. Easing test writing is my primary concern at the moment and I've
> been refactoring marvin to accomadate a easier dsl style test
> composition. I hope to have a working test case sometime next week.
> I haven???t followed this for a while, and I don???t use devCloud .
> Are there any documents describing how to run Marvin test with
> simulator/hypervisors?

I will put in some documentation on how to run them with a simulator.
We already run devcloud tests via our CI system at jenkins.a.o. See my
response to Marcus for the link.

Thanks for your feedback,


View raw message