Release Notes
2.x Branch
Note: This is an unstable alpha release: expect bugs and upcoming changes to the API.
See this blog post for notes about changes to how tests are run.
Features
- Massive realism upgrade: we removed many, many shadows, particularly for views and widgets, so they’ll behave much more realistically.
- Dramatically improved resource loading, with support for themes and styles.
- Easier TestRunner setup and configuration.
- The new
@Config annotation to specify config for a test class or test method:
- The SDK level to report:
@Config(reportSdk=Build.VERSION_CODES.FROYO)
- Qualifiers for resource loading:
@Config(qualifiers="fr-port-hdpi")
- Custom shadow classes to enable.
- For classes and methods that aren’t explicitly shadowed, Robolectric now calls through to the real SDK code.
- Views now complain if you try to pass in a null Context. Don’t do it!
- SDK method execution is now much much faster, especially in cases where we use the actual SDK code rather than a shadow (which will increasingly be the normal case).
- Performance and memory use improvements.
- Removed Hamcrest matchers; use fest-android instead.
- Numerous fixes and improvements from the Robolectric community. Thank you, contributors!
Note: This is an unstable alpha release: expect bugs and upcoming changes to the API.
See this blog post for notes on upgrading.
Features
- Switched from Javassist to ASM for bytecode manipulation: much faster.
- All classes in
android.support.* are now unshadowed and should work as expected.
- Improved resource and library project support.
Note: This is an unstable alpha release: expect bugs and upcoming changes to the API.
Features
- Support for library projects.
- More realistic resource loading, including system resources.
- Much better support for resource qualifiers (e.g. locale, resolution, etc.).
- Groundwork to remove many shadows and use actual android sdk code.
- Moved to org.robolectric package and maven groupId.
1.x Branch
This release contains all updates since April 2nd, including numerous contributions from the Robolectric community (thanks!). There’s partial support for Fragments, and tons of other shadow updates and bug fixes.
Note: This marks the last major release of the 1.x branch; the Robolectric core team is now focusing on the 2.x branch.
Note: We had a little lapse in record-keeping here, sorry.
Note: We had a little lapse in record-keeping here, sorry.
Note: We had a little lapse in record-keeping here, sorry.
Features
- Loads Android platform resources, looks at ANDROID_HOME, local.properties and “which android” to find the Android SDK
- General code cleanup and refactorings, Repackaging of source trees
- Improvements to TestAttributeSet (Thanks Ronald D.!)
- Ant task for mvn that adds the maps.jar to the local mvn repo
- Shadow for ViewStub
- Improvements for Http layer Shadows and fakes
- AndroidManifest.xml parsing improvements
- Added ShadowNotificationManager
Bug Fixes
- Fix bug where layouts were getting included twice
- Fix regressions for early API versions related to BluetoothAdaptor
- Fix bugs in menu view loading
- Various View loading improvements and bug fixes
Note
ant maven-install-jars will update Maven with the correct version of maps.jar
One step back…
- Temporarily reverted loading of Android platform resources – sorry, jumped the gun a bit, it wasn’t quite ready.
Features
- Loading of Android platform resources - Thanks palfrey!
Bug Fix
- Fixed ClassNotFoundExceptions when maps.jar is not being used by the project under test
Features
- Shadow implementation of MenuInflater - Thanks palfrey!
- Lots more shadows, including
Camera, Configuration, WebView, WebSettings, and WebViewClient; better shadows for Activity.startActivityForResult() and SharedPreferences - Thanks mportuesi!
- Fixed a failure caused by the size of
Integer in h2 being different than in SQLite - Thanks billmccord!
- The android-test and maps jars no longer need to be on your project’s test classpath to use Robolectric. You now need to use
RobolectricForMaps.shadowOf() to get the shadow of GeoPoints, MapViews, MapControllers, and ItemizedOverlays.
Note
We have recently changed the Robolectric project structure to work with Maven. If you are developing directly from the repository rather than from a jar release then you should close your IDE, delete its project files (.classpath, *.iml, etc…) and reload the project by importing the pom.xml into your IDE. This process has been tested with both IntelliJ and Eclipse.
Features
- Improved testing of asynchronous and background tasks.
Loopers and AsyncTask background threads are now un-paused by default (see Robolectric.pauseMainLooper() et al.).
- Shadows for
Bitmap, BitmapFactory, and Canvas, and related classes, with textual descriptions (see Robolectric.visualize()) - Thanks xtremelabs!
- Improved HTTP testing (see
Robolectric.addHttpResponseRule()).
- Shadow for
Camera, Camera.Parameters, MediaRecorder - Thanks mportuesi!
- Shadow for
ArrayAdapter - Thanks mylacc!
- Shadow for
ExpandableListView - Thanks casidiablo!
- Nicer stack traces from within shadowed methods.
- Now available from Maven Central (and built with Maven).
- More shadowed methods on numerous classes.
- The
onCreate() method of the application is no longer called automatically as part of test setup and must now be called manually.
Release 0.9.4 - December 14, 2010
Features
- Gingerbread support
- HTTP client support and shadowing
- Shadow for
AssetManager - Thanks gnorsilva!
- Support string references in string resources.
- Support for View background attribute resource id - Thanks macarse!
Bug Fixes
- Remove errant semicolon from generated ShadowSQLiteQueryBuilder - Thanks billmccord!
Release 0.9.3 - December 3, 2010
Features
- Shadow for
AsyncTask
- Integrated contributions for
ShadowConnectivityManager and ShadowNetworkInfo - Thanks macarse!
- A HUGE contribution from the team at Zoodles, the in test SQLite database (
ShadowSQLiteDababase) is backed by h2, reducing the need for database mocking. Thank You Zoodles!
- Robolectric now instantiates applications that are of the type specified in the AndroidManifest.xml - Thanks Mike Burton!
- The Robolectric jars will now work for projects that use the standard Android SDK (and not the Android Google APIs version which contains optional APIs such as Google Maps).
Bug Fixes
- Windows fixes for path separators
- Windows users can ant build the robolectric library and run the robolectric tests
- Colors that reference other colors
- Robolectric will now work on projects that do not use the Google Maps API and other optional packages.
Other
Release 0.9.2 - November 24, 2010
Features
- Shadow classes for SQLite database (Thanks mportuesi!)
- Lint test for shadow methods that match Android methods but are not annotated with @Implementation
- Shadow support for raw resources (Thanks macarse!)
- Improved quick start documentation
Bug Fixes
- Ignore non xml files in layouts directory (Subversion .svn directories were causing cryptic errors, Thanks rlgomes!)
Release 0.9.1 - November 19, 2010
Features
- Integrated support for several new Shadow classes from pull requests – thank you mportuesi!
Bug Fixes
- Fixed JSON “stub!” exceptions.
Release 0.9 - November 17, 2010
Features
- Integrated support for several new Shadow classes from pull requests - Thank you contributors!
- Made the default RobolectricTestRunner robust enough to work without modification for most projects
- Improved the extensibility of RobolectricTestRunner for those projects that do need to add more functionality
- Encapsulated most of the fields on the Shadow classes
- Added support for the android.net.Uri class so that it works the same way in tests that it does in production. This is a departure from the behavior of the Shadow classes. We did this because Uri is a utility class, and it would be almost impossible to write a useful Shadow class for it.
- Improved documentation
- Added run configurations to make it easier to get Robolectric working out of the box
Bug Fixes
- Fixed support for equals(), hashcode(), and toString()
- Improved the documentation for getting Robolectric to work under Eclipse
Release 0.8 - November 5, 2010
Features
- <include> tags apply their attributes to the imported element
- equals(), hashcode(), and toString() can be overridden on all Shadow classes
- Put a link to the Tracker project in the Robolectric User Guide
- Added support for Eclipse
Bug Fixes
- ResourceLoader obtained from context, not stored statically
- Instrumented class cache no longer retains stale entries