Parameterized testing with Robolectric
In our current project we are using Robolectric when writing unit tests for our Android application and it has been working out really well. Recently I needed to write a…
In our current project we are using Robolectric when writing unit tests for our Android application and it has been working out really well. Recently I needed to write a…
If you have worked a while with jUnit you may have seen jUnit Rules. Simply put, a field in a test class annotated with @Rule is a class that lets…
With this blog I just want to share some tips on how to use two interesting test frameworks that are not very well known, Komarro and Catch Exception. Class Under…
When writing your Java unit test you will soon need a way to handle the dependencies of your classes under test. Mockito have some nice features that simplify the creation…
The Infinitest Eclipse plug-in looks for unit tests and have them run as soon as changes are detected. Just as modern IDEs have provided automatic compilation for ages this can…
A while ago I blogged about how to use the PowerMock Rule to bootstrap PowerMock without using a JUnit runner. A problem that you'll likely run into sooner or later…
I’m going to guess that most of you know what instrumentation is. In the event that you don't, instrumentation is a feature in which specific monitoring of the interactions between…
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…
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…
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,…
I had a junit test situation where I wanted to mock an Eclipse IResource instance but still be able to test a call-back implementation given as parameter to the mocked IResource.accept(IResourceVisitor visit) method. By default, mocking an interface gives you "call count" and expected return values but no code is executed. In order to test the implementation of IResourceVisitor, something more had to be done. Here is how I did it.
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.
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…
In a recent post I wrote about the particular problems we've been having with integration testing the Spring LDAP project and the use we've made of Amazon EC2 for solving…
One of the major challenges we've been facing in the Spring LDAP project is to make certain that the library works together with different LDAP servers. Different servers behave differently…