Question

I realize this has been asked before, but the last time was in mid 2008.

If you were starting a new project right now, which one would you use and why? What are their strengths/weaknesses regarding readability, usability, maintainability, and overall robustness?

Was it helpful?

Solution

I have used Easymock earlier, but now I'm using Mockito. I found Mockito simpler as compared to Easymock. For the detailed comparison of Easymock and Mockito you can refer here

OTHER TIPS

To explain our motivation, jMock is an "opinionated" library. It's designed to guide an approach to OO design that focusses on protocols between collaborating objects. If you don't think of your systems in that way, then it's probably not your best option.

I have been using EasyMock for some time, now. Continues to add new features that allow one to reach more of those hard-to-get-to places.

Mockito will save some lines of code for most common test cases.

Could you elaborate on your mock capability needs/priorities? Fairly broad, as stated.

My (biased) answer would be JMockit. For a quick comparison with other mocking toolkits, see the comparison matrix.

Test code written with it should be more readable and better structured (there are example tests for side-by-side comparison). The JMockit mocking API usually requires less "uses" than other mocking APIs to write the same test. The greatest advantage, IMO, is that it doesn't force any design compromises on the code to be tested. On the downside, since JMockit relies on more advanced techniques and has more capabilities, it also has a greater potential for users to run into unexpected difficulties.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top