Thursday, July 28, 2016

Robolectric 3.1.2 is released!

Here's a new version for ya!

Bug Fixes

  • Fix Multidex, Play Services, and Maps support.
  • Fixed NPE when attempting to load non-existent resource (now correctly throws ResourceNotFoundException).

Tuesday, July 12, 2016

Robolectric 3.1.1 is released!

We're gonna start posting release notes here again!


  • None

Bug Fixes

Known Issues

  • PowerMock integration is still broken

Migration guide

Wednesday, October 9, 2013

Robolectric 2.2 Released!

We are happy to announce that the latest version of Robolectric, 2.2, has been released. This release represents several months of work by the Robolectric team and includes some notable improvements. Most interesting is that we've moved one step closer to "Android Reality" by removing one of the main fake pieces of Robolectric — the RoboWindow. We now use the real implementation of Window from the AOSP sources. This has far-reaching consequences but the main one is that we now support the native ActionBar. Your code can now call getActionBar() without getting back a null, and you'll be able to interact with an ActionBar in your tests as well.

There are many other features and fixes added in 2.2. Here's a list of them. Please give Robolectric 2.2 a try and let us know how it goes by directing pull requests and bugfixes to our GitHub repository.

We are aware that Robolectric's documentation is a bit out of date, and we are working on it. Expect documentation updates in the next few days.

Thanks — now get back to testing!


  • Robolectric now does not have a fake implementation of Window (RoboWindow). It has been removed and we now use the internal PhoneWindow class. This allows the getActionBar()method in Activity to return a real ActionBar implementation in tests.
  • To create and manage Activity instances, you must now use the ActivityController interface (see Robolectric.buildActivity())
  • Added visible() method to ActivityControllervisible() must be called on an activity in order for View.isShown() to report back anything but false, since it hooks up the Activity's view hierarchy to the WindowManager.
  • Some shadows were removed (ShadowListActivity)

Bug Fixes

  • Animation.hasEnded() works as expected
  • AsyncTasks no longer swallow exceptions that are thrown during onPostExecute()
  • Context.startActivity() calls can now optionally check if the specified Activity is in thePackageManager using Robolectric.checkActivities(true)
  • Many many issues fixed
  • Better support for Windows development environments
  • Documentation updates!

Wednesday, May 29, 2013

Robolectric 2.1

Robolectric 2.1 is released!


  • Layout inflation is now handled by real Android OS code.
  • Improved support for “style” attribute and theme queries in layout attributes.
  • Implemented AssetManager.openXmlResourceParser().
  • Support for using disk-based SQLite databases.

Bug Fixes

  • ActionBarSherlock should work, pretty much.
  • Fixed bugs in Handler.sendMessageAtTime(), and various timing issues.
  • Numerous other fixes and improvements from the Robolectric community! Thank you contributors!

Known Issues

  • Animations aren’t well-supported.

From the creator of Robolectric...

If Burning Man, or LGBT stuff, or a little playground humor turn you off, you can safely skip this post. Depending on your work environment, this may be mildly NSFW.

Shameless plug alert! I have another sheep-related project. Total coincidence. This one is an art piece bound for Burning Man: a giant mobile sheep-bus with a big soundsystem, a social message, some crazy awesome light effects, an unusual mode of entry, and a bunch of other nifty stuff. Oh, and he just happens to be a gay sheep. Not that it makes a difference, right?

Our Kickstarter campaign is finishing in a couple days, and we'd love to make it to $15K. If Robolectric has made your life a little better, consider kicking in some bucks to help us make Robolectric's real-world cousin amazingly awesome!

Don't worry, I don't fancy myself a DJ: we're corralling some really top-notch DJs and live performers, both acclaimed and underground, from around the world to entertain and make magic. This project is bringing together an incredible team of artists, engineers, builders, planners, and performers to create a rolling party. He'll debut at Burning Man 2013, but he'll be making appearances at events off-playa as well.

BAAAHS Kickstarter (I'm the guy at the start of the video)
BAAAHS Facebook page

Thursday, May 23, 2013

Configuring Robolectric 2.0

In Robolectric 1.x, it was necessary to extend RobolectricTestRunner if you wanted to configure things differently.

From 2.0 on, most configuration can be accomplished using either the @Config annotation or by adding a special file on your classpath.

You can add the @Config annotation to individual test methods, or entire test classes.

If you'd like to apply a configuration to your entire project, create a file called "", and place it on your classpath. If you're using maven, you could put it in src/test/resources.


public void shouldDisplayThingsInFrench() {

Configurable values currently include which manifest to use, the SDK level and qualifiers to report, and the list of additional shadows to enable. See the @Config annotation documentation for details.

Also, remember that Robolectric will now look for a test version of your Application class, where you can do additional configuration which used to require subclassing RobolectricTestRunner.

Wednesday, May 15, 2013

Robolectric 2.0 final!

Robolectric 2.0 is, at long last, finished! Thanks for all the bug reports over the last week.

We'll have some blog posts in the coming week talking about new features.

Use it!

If you've been using Robolectric 1.x, see the blog post on migrating to Robolectric 2.0.

If you're new to Robolectric, just add this to your pom:
Add a @RunWith to your test class and you're ready to go!
public class MyActivityTest {


If you find bugs, make an issue on our github project.