Releases: robolectric/robolectric
Robolectric 3.4 RC2
NOTE: Robolectric 3.4-rc2 is a outdated release candidate; please use 3.4-rc3 instead.
Robolectric 3.4 RC1
NOTE: Robolectric 3.4-rc1 is a outdated release candidate; please use 3.4-rc2 instead.
Robolectric 3.3.2
Robolectric 3.3.2 provides support for Android O Developer Preview 1, improves startup time, and resolves a licensing issue.
Features:
- Initial support for Android O runtime [issue #2988].
Bug Fixes:
- Fix issues with
PackageManager
simulation:addPackage()
should not create sessions [issues #2984 and #2950]. - Fix deadlock caused by synchronicity of Scheduler [issues #2115, #1043, and #2982].
- Fix
NoClassDefFoundError: javax/microedition/khronos/opengles/GL
[issues #2960 and #1932]. - Fixed: instrumentation fails for abstract subclasses of framework classes [issue #2951 and #2983].
Misc:
- Switch from VTD to StAX for parsing resource xml; resolves licensing issue and reduces resource parsing time by about 60% [issues #2964, #2865, and #1414].
- Clean up temp dirs left behind after test runs.
Use Robolectric:
testCompile "org.robolectric:robolectric:3.3.2"
Find more details here. Report issues here. Enjoy!
Robolectric 3.3.1
Robolectric 3.3.1 fixes a few bugs; details below.
Android Simulation Changes
- Support PackageManager.getXml() [issue #2953].
Bug Fixes:
- Fix issue with PowerMock [issues #2944, #2749, #2952].
- Allow overriding the assets directory in Gradle builds [issue #2939].
- Fix
Html.fromHtml()
/System.arraycopy()
bug [issue #2959].
Use Robolectric:
testCompile "org.robolectric:robolectric:3.3.1"
Find more details here. Report issues here. Enjoy!
Robolectric 3.3
Robolectric 3.3 fixes some long-standing bugs (notably PowerMock and Mockito integration) and adds some significant new features. Details below.
New Features
- Added support for the Buck build system [issue #2907].
- Added support for generic build system integration [issue #2912].
Android Simulation Changes
<array>
resources are now supported [issue #2064].Context#getExternalFilesDirs
now supported [issue #2818].- Implemented
android.opengl.Matrix
[issue #2893]. - Implemented a bunch of methods in
PackageManager
: [issue #2913].checkSignatures()
getDefaultActivityIcon()
getInstalledApplications()
getInstallerPackageName()
andsetInstallerPackageName()
getPackageSizeInfo()
(UseaddPackage()
to control behavior.)getPermissionInfo()
(Use manifest oraddPermissionInfo()
to control behavior.)resolveContentProvider()
- Implemented a bunch of methods in
AccountManager
: [issue #2906].- All methods which return a
AccountManagerFuture
will now post their work to the specifiedHandler
, so it will be deferred or executed immediately depending on the state of itsScheduler
.
- All methods which return a
- Added initial support for WifiP2pManager [issue #2933].
View.getGlobalVisibleRect()
now uses the framework implementation unlesssetGlobalVisibleRect()
has been called.
API Changes:
- Several classes have moved to new packages. See Migration Guide for details [issue #2873].
PackageManager
's behavior is moving from a subclass to a shadow. See the Migration Guide [issue #2887]- Deprecated
RuntimeEnvironment.getPackageManager()
. Use Android APIs instead. - Deprecated
ShadowConfiguration
. UseConfiguration
directly instead. - Deprecated
ShadowView#getQualifiers()
. UseRobolectric.getQualifiers()
instead. - Deprecated
*Controller.withIntent()
and.attach()
[issue #2938]. - Removed deprecated
ShadowLocation
. Note thatLocation.equals()
is no longer shadowed with special equality rules. [issue #2932] - Removed deprecated
ShadowNotification.getProgressBar()
,ShadowDrawable.reset()
,ShadowContentResolver.registerProvider()
,ShadowContentResolver.getContentObserver()
,ShadowImageView.getImageResourceId()
, andShadowImageView.getImageBitmap()
[issue #2932]. - Removed deprecated
ShadowIntentFilter
. - Removed deprecated
RoboAttributeSet
andAttribute
class. UseRobolectric.buildAttributeSet()
instead. - Removed deprecated
MultiApiRobolectricTestRunner
[issue #2924]. - The jars that comprise Robolectric have changed a bit. If your build system doesn't automatically pull in dependencies, see this post on (hermetic builds)[http://robolectric.org/blog/2017/03/01/hermetic-builds/] for more info.
Bug Fixes:
- Fixed: PowerMock broken [issue #2208].
- Fixed: Mockito experimental mocking of finals is broken [issue #2677].
- Fixed a bug causing styleable attribute lookup in application resources to fail sometimes [issue #2878].
- Fixed a bug which caused non-layout resources to be seen as layouts [issue #2882].
- Fixed
View.getWindowId()
to behave more like Android [issue #2888]. - Fixed a bug in
BitmapRegionDecoder
[issue #2926]. - Fixed a bug in
PackageMAnager.queryIntentContentProviders()
[issue #2927].
Known Issues:
- Some styles may still not resolve properly [issue #2787].
Use Robolectric:
testCompile "org.robolectric:robolectric:3.3"
Find more details here.
Robolectric 3.2.2
Bug Fixes:
- Fixed: PhoneUtils broken starting from
M
(getResourceAsStream
is broken) [issue #2773]. - Fixed: Robolectric reports all tests running with SDK [16] [issue #2836].
- Fixed: Memory Leak when testing Activities [issue #2068].
- Fixed: Global
robolectric.properties
file is not loaded [issue #2843].
API Changes:
ShadowLocation
has been deprecated and will be removed in a future major release.
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.2"
Find more details here.
Robolectric 3.2.1
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 callsetColumnCount()
[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.
Robolectric 3.2
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()
orshadowOf(matrix).getPostOperations()
etc. instead. - Matrix operations applied to
Bitmap
s now cause the size of theBitmap
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()
andenforceInterface()
are now implemented.- Binary Drawables with qualifiers (e.g. in
drawable-hdpi
) can now be accessed usingResources.openRawResource()
. BitmapRegionDecoder
is now implemented; bitmap width and height are correctly detected.AssetManager.getThemeValue()
now honors the value of theresolveRefs
argument, and correctly handles style references to attributes in another package.ShadowIcon
provides accessors for hiddenIcon
internals.JobScheduler.cancel()
andLooper.quitSafely()
are now implemented.Canvas.drawBitmap()
with destinationRectF
is now implemented.IntentFilter
now uses all-framework code. Previously,equals()
andhashCode()
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 withmanifest = "--default"
any more.- Specify
@Implements(minSdk/maxSdk)
or@Implementation(minSdk/maxSdk)
to restrict shadow classes and methods to the given Android SDK levels. ShadowIntentFilter
has been deprecated and will be removed in the next major 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. - When injecting a
RoboCursor
, be sure to callsetColumnNames()
on it if you care about whatgetColumnCount()
will return later.
Bug Fixes:
- Fixed
java.util.ServiceConfigurationError: org.robolectric.internal.ShadowProvider: Provider org.robolectric.Shadows not a subtype
[issue #2737]. - 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.
Robolectric 3.2-rc1
NOTE: Robolectric 3.2-rc1 is a outdated release candidate; please use 3.2 instead.
Robolectric 3.1.4
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.