RHQ & mockito

Charles Crouch ccrouch at redhat.com
Fri Jan 27 22:38:54 UTC 2012


A seemingly decent comparison of easymock and mockito (which I learned was a fork of easymock)...
http://java.dzone.com/articles/mockito-pros-cons-and-best

It would appear we have some easymock floating around already:
http://git.fedorahosted.org/git/?p=rhq%2Frhq.git&a=search&h=HEAD&st=grep&s=easymock

but as mazz mentioned today, that wasn't due to any team wide decision, so don't let that slow you down.

Did you take a look at jmockit?
http://stackoverflow.com/questions/4105592/comparison-between-mockito-vs-jmockit-why-is-mockito-voted-better-than-jmockit
http://jmockit.googlecode.com/svn/trunk/www/about.html

One thing I'd eventually like to validate is that our tests running with the chosen mocking library are compatible with the cobertura configuration which Filip had previously setup. Though I don't expect there to be major issues.


Taking a step back, the following should be required reading, or re-reading, for folks as we dive into this area more deeply:
http://martinfowler.com/articles/mocksArentStubs.html
TBH I think we could get a lot of value from just the stubbing capabilities these mocking frameworks provide, let alone all their actual mocking capabilities.

Cheers
Charles


----- Original Message -----
> Hello Everybody,
> 
> I've done some recent research into mocking frameworks for use with
> RHQ tests. Out of all the frameworks I stumbled upon, mockito looked
> the best (http://code.google.com/p/mockito/).
> 
> Here are some features that set mockito apart:
> - fluid interfaces
> - concise api
> - very good documentation (eg:
> http://docs.mockito.googlecode.com/hg/latest/org/mockito/Mockito.html)
> - vibrant & active community
> - good maven integration, updates promptly published to maven repos
> 
> 
> I know that jMock was used in some parts of RHQ however I find
> mockito superior especially around argument matchers, number of
> invocations, and call order. Please take a look at this blog post
> for a detailed comparison:
> http://www.zsoltfabok.com/blog/2010/08/jmock-versus-mockito/
> 
> 
> I started this research in order to improve test coverage for the
> content system. My plan is to give mockito a try in that context and
> if successful apply it more broadly.
> 
> Any feedback or ideas are more than welcome.
> 
> 
> Thank you,
> Stefan Negrea
> 
> Software Engineer
> 
> _______________________________________________
> rhq-devel mailing list
> rhq-devel at lists.fedorahosted.org
> https://fedorahosted.org/mailman/listinfo/rhq-devel
> 
> 
> 


More information about the rhq-devel mailing list