views:

80

answers:

3

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?

+1  A: 

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.

bug11
I'm selecting a tool for a new project and expect to have fairly ordinary usage. Anything Mockito can't do that EasyMock does?
HDave
Then Mockito may save you some time and result in a little better readability in your test cases.
bug11
+1  A: 

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

Amit Goyal
Mockito certainly looks more readable than Easymock. Thats an important criteria for a unit test.
HDave
A: 

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.

Rogerio