File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Testing and the fly likes Mockito versus Powermock Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "Mockito versus Powermock" Watch "Mockito versus Powermock" New topic
Author

Mockito versus Powermock

Rene Ummels
Greenhorn

Joined: Feb 12, 2010
Posts: 11
Hi Tomek,

I use the following rule for usage of Mockito versus Powermock. In our company we use Mockito.

Rule: Do not use Powermock, unless it is really needed (think!). Use it per maven sub-project and then use it consistently (not using both Mockito and Powermock).
- Powermock shall never be used to hide bad design.
- Powermock is allowed in testing Abstract Factory.
- The Sonar check concerning final methods / classes is nonsense; how can you ever be sure that you are never going to extend a class or method? Conclusion: Do not use Powermock to test existing final methods or classes in your code but remove the final keyword.

Do you have any suggestions on my rule?
Any suggestions (adding text, removing text, changing text) or sharing thoughts are appreciated.


kind regards,
Rene Ummels
Billy Tsai
Ranch Hand

Joined: May 23, 2003
Posts: 1304
are Mockito and TestNG two totally different testing frameworks?
what are their main differenences?
Rene Ummels
Greenhorn

Joined: Feb 12, 2010
Posts: 11
Hi Billy,

Did you add your question(s) on purpose to my post, or did you do it by mistake?


///Rene
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Mockito versus Powermock