robolectric

Android Unit Testing Framework

OTHER License

Stars
5.8K
Committers
672

Bot releases are hidden (Show)

robolectric - Robolectric 3.5.1

Published by xian almost 7 years ago

Robolectric 3.5.1 provides support for Android O_MR1 8.1 beta and two regression fixes.

Features:

  • Support for Android O_MR1 8.1 build 4402310 [issue #3481].

Bug Fixes:

  • Reverts upgrade of bounceycastle which caused SSL handshake failures on some machines. A workaround for people whose builds were fixed by the upgrade is here [issue #3481].
  • Fixed a bug for Buck users that caused an IllegalStateException [issue #3478].

Use Robolectric:

testCompile "org.robolectric:robolectric:3.5.1"

Find more details here. Report issues here. Enjoy!

robolectric - Robolectric 3.5

Published by xian almost 7 years ago

Robolectric 3.5 provides support for Android O 8.0.0_r4 and includes numerous fixes and improvements.

Features:

  • Support for Android O 8.0.0_r4 [issue #3439].
  • Added shadows for DevicePolicyManager [issue #3325] and UsbManager [issue #3420].

Fidelity Improvements

  • Exceptions thrown during Filterable filtering are now correctly caught [issue #3331].
  • Fixed a bug involving AlarmManager and PendingIntents [issue #3332].
  • WebView handles history more consistently [issue #3347].
  • Added attributes and intent filters to BroadcastReceiverData and ServiceData from the manifest [issue #3361].
  • Implemented ApplicationPackageManager.getPackageUid() [issue #3370].
  • Implemented ContentResolver.getPersistedUriPermissions() [issue #3400].
  • Implemented PowerManager.isIgnoringBatteryOptimizations() [issue #3399].
  • Implemented KeyguardManager#isKeyguardLocked() [issue #3401].
  • Implemented UserManager.getSerialNumberForUser() [issue #3406].
  • Implemented NotificationManager.deleteNotificationChannelGroup() [issue #3334] and createNotificationChannels() [issue #3340].
  • More realistic values now provided for ApplicationInfo.uid and Process.myUid() [issue #3440].
  • Implemented TextUtils.ellipsize() [issue #3442].
  • Improved support for KeyguardManager on O [issue #3454].
  • Updated bounceycastle to latest (1.58) [issue #3458].
  • Activity.finishAffinity() correctly causes an activity to be marked finished [issue #3460].

Bug Fixes:

  • Fixes a bug that could cause deadlocks when using AsyncTask [issue #3321].
  • Fixed a bug that caused exceptions thrown during filtering to be incorrectly thrown [issue #3331].
  • ShadowAlarmManager bug fix: PendingIntent equals check now includes requestCode type check [issue #3332].
  • Separated postFrameCallback delay control from postCallback. [issue #3335].
  • Disable animation during DrawerLayout.openDrawer/closeDrawer [issue #3336].
  • Fixed an issue that caused missing resources to throw incorrect exceptions [issues #3312 and #3283].
  • AccessibilityManager now retains state correctly [issue #3372].
  • Fonts in the res directory no longer cause an exception [issue #3398].
  • Improved support for Buck projects with many library dependencies [issue #3429].
  • Improved support for Java 9 [issue #3432].

Deprecations:

  • Deprecated ManifestFactory.create(), RuntimeEnvironment.getAppManifest(), and ShadowApplication.getAppManifest() [issue #3447]. AndroidManifest itself will be deprecated soon; use PackageManager instead.
  • Deprecated WebView.setCanGoBack().
  • Deprecated org.robolectric.util.SimpleFuture [issue #3321].

Misc:

  • Shadow artifacts names are once again correctly prefixed with 'shadows-', so e.g. shadows-framework, etc. Sorry for the thrash on this.
  • Removed support for obsolete Maps API v1 [issue #3305].
  • Shadowed constructor and static initializer methods must now be annotated @Implementation (issue #3122).

Use Robolectric:

testCompile "org.robolectric:robolectric:3.5"

Find more details here. Report issues here. Enjoy!

robolectric - Robolectric 3.4.2

Published by hoisie about 7 years ago

Robolectric 3.4.2 updates the supported version of Android O to Developer Preview 4.

robolectric - Robolectric 3.4.1

Published by xian about 7 years ago

NOTE: this release has a minor bug and has been superseded by 3.4.2.

robolectric - Robolectric 3.4

Published by xian about 7 years ago

Robolectric 3.4 improves support for Android O Developer Preview 2, PackageManager, and many other Android classes, and resolves numerous bugs.

Features:

  • Improved support for NotificationManager features added in Android O [issue #3041].
  • Added test APIs for BatteryManager [issue #3006].
  • Added test APIs for UserManager user restrictions [issue #3027].
  • Added test API for PowerManager.newWakeLock() [issue 3078].
  • Added BackupAgentController test API for backup agents [issue #3016].
  • Added support for BuildCompat's version checking methods; Build.VERSION.CODENAME is now correctly initialized [issue #3031].
  • Improved test API and documentation for ContentResolver.
  • Configuration.orientation now matches the orientation indicated by @Config(qualifiers) [issue #3046].
  • SharedPreferences uses real Android SDK code rather than a shadow [issue #3051].
  • Robolectric.setupContentProvider() can now be called with an authority string [issue #3019].
  • Metadata from manifest is now available for ContentProviders [issue #3022].
  • Added support for SensorManager.createDirectChannel().
  • Added support for get{Target|Creator}Package() to ShadowPendingIntent [issue #3033].
  • Improved support for PackageManager.getResourcesForApplication() [issue #3133].
  • Improved support for PackageManager.queryPermissionsByGroup() [issue #3160].
  • Improved support for PackageManager.getApplicationInfo() [issue #3160].
  • Improved support for PackageManager.getProviderInfo() [issue #3191].
  • ShadowInputMethodManager now supports a callback mechanism for soft input visibility changes [Issue #3136].
  • Added support for several additional methods on StatFs [issue #3128].
  • Added support for WifiManager.getPrivilegedConfiguredNetworks() [issue #3134].
  • Added support for WifiManager#getWifiState() [issue #3146].
  • Added support for WifiManager#isScanAlwaysAvailable() [issue #3259].
  • Added support for queryIntentService() from Manifest [issue #3153].
  • Added support for UserManager.isManagedProfile() [issue #3154].
  • Added PackageInfo.name value to ActivityInfo [issue #3159].
  • Improved support for DownloadManager [issue #3163].
  • Added support for Session.abandon() [issue #3189].
  • Added support for JobScheduler.getPendingJob(int) introduced in Android N [issue #3195].
  • Added support for ‘ShortcutManager’ [issue #3239].
  • Added support for ‘NotificationManager.deleteNotificationChannel’ [issue #3238].
  • Support overridden packages with AGP3.0 [issue #3229].
  • Make TempDirectory shared across entire test env [issue #3199].
  • Added support for AudioManager and TelephonyManager [issue #3255].
  • ShadowService.foregroundStopped is now reset when a service goes into the foreground [issue #3261].
  • ShadowChoreographer now allows customized delay to be specified by application for postCallback and postFrameCallback to avoid animation problems during test [issue #3262].
  • Added correct listen() behavior to ShadowTelephonyManager [issue #3271].

Bug Fixes:

  • Fixed a bug in ShadowLog.getLogs() and getLogsForTags() [issue #3007].
  • Supports targetSdkVersion of O [issue #3037].
  • Fixed a bug that caused Resources.openRawResource() to throw the wrong exception for missing resources [issue #3059].
  • Fixed support for null content values in ContentResolver [issue #3067].
  • Fixed an issue that caused Looper tasks to leak between tests [issue #2963].
  • Fixed a bug parsing escape sequences in string resources [issue #3071].
  • Fixed a bug that could cause temporary files to leak between tests [issue #3081].
  • Fixed a bug that caused MessageQueue to block adding messages to the queue while a message was being handled [issue #3082].
  • Updated ShadowSensorManager and ShadowNotificationManager to be compatible with older SDK versions [issue #3103, #3101].
  • Fixed a bug that caused ActivityManager.getRunningAppProcesses() to return an empty list instead of null [issue #3124].
  • Fixed a bug that prevented BluetoothDevice objects from being created [issue #3197].
  • Fixed a crash in WifiConfiguration.toString() [issue #3144].
  • Fixed Choreographer constructor for O [issue #3240].
  • Fixed race condition in ShadowSQLiteConnection.reset [issue #3211].
  • Fixed a bug that caused file descriptor leaks [issue #3253].
  • Fixed a bug that caused an NPE for some configurations [issue #3220].
  • Fixed a bug that caused an NPE if there's a non-directory with the 'values' prefix in res [issue #3158].

Misc:

  • Robolectric now requires JDK8.
  • Removed deprecated DefaultPackageManager and RobolectricPackageManager [issues #3203 and #3264].
  • Removed deprecated org.robolectric.util controllers [issue #3087].
  • Removed deprecated ShadowConfiguration [issue #3094].
  • Removed deprecated Transcript [issue #3113].
  • Removed unneeded *LayoutParams Shadows [issue #3118].
  • Removed deprecated StubPackageManager [issue #3151].
  • Removed unneeded *CursorAdapter Shadows [issue #3117].
  • Removed deprecated ComponentController.attach() method [issue #3185].
  • Removed deprecated org.robolectric.res.builder.XmlResourceParserImpl.
  • Some Robolectric sub-projects have been renamed. build.gradle files will need to updated accordingly. [issue #3186]:
    • robolectric-annotations -> annotations
    • robolectric-junit -> junit
    • robolectric-processor -> processor
    • robolectric-resources -> resources
    • robolectric-sandbox -> sandbox
    • robolectric-utils -> utils
    • shadows-core -> framework
    • shadows-httpclient -> httpclient
    • shadows-maps -> maps
    • shadows-multidex -> multidex
    • shadows-play-services -> playservices
    • shadows-support-v4 -> supportv4
  • Deprecated @Config attributes that are supplied via new build system API [issue #3230].
  • Bumped android stubs to API 26 [issue #3241].
  • Removed RuntimeAdapter [issue #3218].
  • Removed deprecated ShadowExtractor, AccessibilityUtil, and RoboExecutorService [issue #3174].

Use Robolectric:

testCompile "org.robolectric:robolectric:3.4"

Find more details here. Report issues here. Migration notes here. Enjoy!

robolectric - Robolectric 3.4 RC5

Published by xian about 7 years ago

NOTE: Robolectric 3.4-rc4 is a outdated release candidate; please use 3.4-rc5 instead.

robolectric - Robolectric 3.4 RC3

Published by hoisie over 7 years ago

NOTE: Robolectric 3.4-rc3 is a outdated release candidate; please use 3.4-rc4 instead.

robolectric - Robolectric 3.4 RC2

Published by hoisie over 7 years ago

NOTE: Robolectric 3.4-rc2 is a outdated release candidate; please use 3.4-rc3 instead.

robolectric - Robolectric 3.4 RC1

Published by xian over 7 years ago

NOTE: Robolectric 3.4-rc1 is a outdated release candidate; please use 3.4-rc2 instead.

robolectric - Robolectric 3.3.2

Published by jongerrish over 7 years ago

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 - Robolectric 3.3.1

Published by xian over 7 years ago

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 - Robolectric 3.3

Published by xian over 7 years ago

Robolectric 3.3 fixes some long-standing bugs (notably PowerMock and Mockito integration) and adds some significant new features. Details below.

New Features

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() and setInstallerPackageName()
    • getPackageSizeInfo() (Use addPackage() to control behavior.)
    • getPermissionInfo() (Use manifest or addPermissionInfo() 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 specified Handler, so it will be deferred or executed immediately depending on the state of its Scheduler.
  • Added initial support for WifiP2pManager [issue #2933].
  • View.getGlobalVisibleRect() now uses the framework implementation unless setGlobalVisibleRect() 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. Use Configuration directly instead.
  • Deprecated ShadowView#getQualifiers(). Use Robolectric.getQualifiers() instead.
  • Deprecated *Controller.withIntent() and .attach() [issue #2938].
  • Removed deprecated ShadowLocation. Note that Location.equals() is no longer shadowed with special equality rules. [issue #2932]
  • Removed deprecated ShadowNotification.getProgressBar(), ShadowDrawable.reset(), ShadowContentResolver.registerProvider(), ShadowContentResolver.getContentObserver(), ShadowImageView.getImageResourceId(), and ShadowImageView.getImageBitmap() [issue #2932].
  • Removed deprecated ShadowIntentFilter.
  • Removed deprecated RoboAttributeSet and Attribute class. Use Robolectric.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 - Robolectric 3.2

Published by xian over 7 years ago

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.
  • 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 call setColumnNames() on it if you care about what getColumnCount() 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 - Robolectric 3.2.2

Published by xian almost 8 years ago

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 - Robolectric 3.2.1

Published by xian almost 8 years ago

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.

robolectric - Robolectric 3.2-rc1

Published by xian almost 8 years ago

NOTE: Robolectric 3.2-rc1 is a outdated release candidate; please use 3.2 instead.

robolectric - Robolectric 3.1.4

Published by xian almost 8 years ago

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.

robolectric - Robolectric 3.1.1

Published by xian almost 8 years ago

robolectric - Robolectric 3.1.2

Published by xian almost 8 years ago

Android Simulation Changes:

  • Improvements to Multidex, Play Services, and Maps support.
  • Fixed NullPointerException when attempting to load non-existent resource (now correctly throws ResourceNotFoundException).
robolectric - Robolectric 3.1.3

Published by xian almost 8 years ago

Android Simulation Changes:

  • 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.
  • Robolectric's PackageManager is more fully implemented; e.g. you can now setPackagesForUid().

API Changes:

  • ContentProviders should be created using Robolectric.buildContentProvider(), which simulates how the framework creates them (and calls onCreate() automatically).
  • 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").

Known Issues:

  • Some issues resolving styles (particularly related to AppCompat) still exist.