Background
In PowerMock we’re using a custom classloader to byte-code manipulate classes that are normally not mockable to make them mockable. But when running a test case there may be some cases when the user needs to byte-code manipulate a certain class (X) in the first test method but needs to have the class unmodified in [...]
Classloader Deep-Cloning without Serialization
December 23rd, 2009 by Johan Haleby — Java, Testing
Tags: classloader, deep-cloning, frameworks, junit, manipulate, open source, powermock, serialization, tools
PowerMock + TestNG = True
December 14th, 2009 by Johan Haleby — Java, Testing
After having it on our todo list for at least a year we’ve finally managed to integrate PowerMock with TestNG 5.11 as of PowerMock version 1.3.5. This is a big milestone of the project since we’ve now demonstrated that PowerMock is decoupled from both a specific test framework and a specific mock framework. The TestNG [...]
Tags: frameworks, open source, powermock, testng
Mocking static methods in Java system classes
May 17th, 2009 by Johan Haleby — Java, Testing
As you may already know PowerMock can be used to easily mock static methods which is normally not possible with standard mock frameworks such as EasyMock, JMock or Mockito. All you have to do is to use mockStatic in one of the PowerMock extension API’s as well as telling PowerMock to enable the class for [...]
Tags: frameworks, open source, powermock, tdd, tools
PowerMock Part 2
May 1st, 2009 by Johan Haleby — Java, Testing
In JayView 17 we presented a short introduction to PowerMock, a framework that allows you to create automated tests for almost any code in isolation from its environment. In this article we’ll dig a bit deeper into PowerMock and explore the goals and more of its feature set.
Background
PowerMock is intended for developers who want [...]
Tags: automated testing, frameworks, open source, powermock
Questioning “testable design”
April 1st, 2009 by Mattias Ask — Architecture, Java, Testing
After a discussion about PowerMock with @olabini on Twitter I felt I had to write a post on testability.
The truth “Autonomous, re-runnable, code-based tests are objectivity good” has created a perceived truth, namely “Testable design is good design”. This assumption is incorrect.
The phrase “testable design” is dependent of two things; the design of the code [...]
Tags: frameworks, powermock, toos, twitter
Getting started with JavaME jUnit testing
March 22nd, 2009 by Mattias Severson — Embedded, Java, Testing
Introduction
Unit testing is a very powerful tool that should be included in every developer’s toolbox. Unfortunately, this has not always been the case, especially not among MIDlet developers. One reason is that JavaME projects usually are small (compared to Java SE projects), which implies that manual testing could be enough. However, as soon as you [...]
Tags: java me, junit, mock, powermock
How to mock MIDP RecordStore
March 22nd, 2009 by Mattias Severson — Embedded, Java, Testing
The challenge
PowerMock is a mocking framework that claims to have almost supernatural powers. According to its documentation it is able to mock both static and private methods, final classes, and other nasty things that would be insurmountable obstacles for other mock frameworks. As a result, it has been stated that it should be able to [...]
Tags: java me, junit, mock, powermock
What’s new in PowerMock 1.1
December 15th, 2008 by Johan Haleby — Java, Testing
We’re proud to announce that PowerMock 1.1 was released a couple of days ago and it has many new interesting features.
Framework independence
First of all the internal structure of the project has undergone major changes. PowerMock core is no longer coupled to EasyMock which means that PowerMock can now be used as a foundation for [...]
Tags: commons-logging, easymock, frameworks, jmock, log4j, mockito, open source, powermock, slf4j, testng
PowerMock 1.0 released
November 21st, 2008 by Jan Kronquist — Java, Testing
We have released 1.0 of PowerMock just in time for the Øredev conference! PowerMock is an open source mock framework based on EasyMock that allow you to mock static methods, private methods and even constructors. Our intent is mainly to allow unit testing of legacy code and people really seemed to appreciate this idea at the conference.
Tags: easymock, junit, mock, open source, oredev, powermock
PowerMock 0.8 released
October 27th, 2008 by Johan Haleby — Java, Testing
Previously a colleague of mine described an idea for mocking static methods. Earlier this year we started an open source project to implement these ideas in a very simple to use form. The idea is that it will just be a normal jar file that extends EasyMock and JUnit. Instead of using AspectJ we have [...]
Tags: easymock, frameworks, junit, mock, open source, powermock
