Friday, January 6, 2017

Robolectric 3.2.1 is released!

Bug Fixes:

  • Fixed: Unable to run Robolectric 3.2 under Windows [issue #2814].
  • Fixed: Mockito @InjectMocks broken [issue #2442].
  • RoboCursor.getColumnCount() now returns the number of columns in the result data (as before), unless you explicitly call setColumnCount() [issue #2830].
  • Xml with non-reference style attribute value should return 0 for getStyleAttribute() [issue #2829].

Known Issues:

  • PowerMock broken [issue #2208].
  • Mockito experimental mocking of finals is broken [issue #2677].
  • Some styles may still not resolve properly [issue #2787].

Use Robolectric:

testCompile "org.robolectric:robolectric:3.2.1"
Find more details here.

Wednesday, January 4, 2017

Robolectric 3.2 is released!

Android SDK Support

  • Android N (API level 24, framework code version 7.0.0_r1) and N_MR1 (API level 25, framework code version 7.1.0_r7) are now supported.
  • Android M (API level 23) framework code has been bumped from 6.0.0_r1 to 6.0.1_r3.
  • Numerous resource resolution bugs related to AppCompat 24 when running on older SDKs have been fixed.

New Features

  • RobolectricTestRunner now supports running tests against multiple SDKs. See Configuring Robolectric for more details.

Android Simulation Changes:

  • Matrix is now more fully implemented.
  • Matrix.toString() no longer returns a summary of operations. You may use shadowOf(matrix).getDescription() or shadowOf(matrix).getPostOperations() etc. instead.
  • Matrix operations applied to Bitmaps now cause the size of the Bitmap to change accordingly.
  • Drawable resources declared as <item type="drawable"/> are now supported.
  • Location listeners registered multiple times with LocationManager.requestLocationUpdates()will only receive one notification.
  • Parcelable.readException()writeInterfaceToken() and enforceInterface() are now implemented.
  • Binary Drawables with qualifiers (e.g. in drawable-hdpi) can now be accessed using Resources.openRawResource().
  • BitmapRegionDecoder is now implemented; bitmap width and height are correctly detected.
  • AssetManager.getThemeValue() now honors the value of the resolveRefs argument, and correctly handles style references to attributes in another package.
  • ShadowIcon provides accessors for hidden Icon internals.
  • JobScheduler.cancel() and Looper.quitSafely() are now implemented.
  • Canvas.drawBitmap() with destination RectF is now implemented.
  • IntentFilter now uses all-framework code. Previously, equals() and hashCode() had a partial shadow implementation, but now they are unimplemented.
  • Some additional methods on RoboCursor are now implemented.
  • XmlPullParser.getIdAttributeResourceValue() now resolves references.
  • NotificationManager.getActiveNotifications() is now implemented.
  • Added basic support for device protected storage contexts.
  • Added basic support for setting state of UserManager.isUserUnlocked().

API Changes:

  • ManifestFactory.identify() won't be called with manifest = "--default" any more.
  • Specify @Implements(minSdk/maxSdk) or @Implementation(minSdk/maxSdk) to restrict shadow classes and methods to the given Android SDK levels.
  • ShadowLocation and ShadowIntentFilter have been deprecated and will be removed in the next release.
  • If you are doing custom configuration using a subclass of RobolectricTestRunner you'll probably need to make a few changes. See Migration Guide for details.

Bug Fixes:

  • A number of race conditions and minor bugs have been fixed.

Known Issues:

  • Robolectric still has issues with PowerMock and Mockito [issues #2429 and #2677]. We'll have a fix soon, promise!
  • Some styles may still not resolve properly [issue #2787].
  • Fails to run on Windows [issue #2814].

Thanks to the many contributors to this release!

Use Robolectric:

testCompile "org.robolectric:robolectric:3.2"
Find more details here.

Monday, October 31, 2016

Robolectric 3.1.4 is released!

This release fixes an issue that prevented running tests for projects without an explicit dependency on org.robolectric:shadows-core. If version 3.1.3 was working for you, there'll be no changes in 3.1.4.

Wednesday, October 26, 2016

Robolectric 3.1.3 is released!

Among the changes you'll find in this version:

  • Robolectric's handling of styles and themes is now much more faithful to Android's actual behavior. Missing styles (often from AppCompat) are now more likely to cause failures, so you'll generally want to set a theme, either through your manifest or programmatically.
  • Missing resources and attributes which silently failed or defaulted to platform attributes with the same name will now raise errors.
  • ContentProviders should be created using Robolectric.buildContentProvider(), which simulates how the framework creates them (and calls onCreate() automatically).
  • Robolectric's PackageManager is more fully implemented; e.g. you can now setPackagesForUid().
  • RoboMenuItems should be constructed with a context.
  • RobolectricTestRunner has been changed to make it easier to customize manifest loading, while retaining caching. If you have a custom test runner, you should override getManifestFactory() instead of getAppManifest().
  • You can enable style resolution debug output by turning on logging (by setting the robolectric.logging.enabled system property to "true").


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!


Features

  • None

Bug Fixes

Known Issues

  • PowerMock integration is still broken

Migration guide