This release is alpha-quality, and targeted at early adopters. We expect that there'll be bugs. We expect APIs to change before final release. Please use this alpha only if you can deal with some churn.
Big thanks to Square for giving us time to work on this.
Changes so far:
- Using real android fragment manager code from the support lib.
- More realistic resource loading, including system resources.
- Much better support for resource qualifiers (e.g. locale, resolution, etc.).
- Support for library projects.
- Groundwork to remove many shadows and use actual android sdk code.
- Moved to org.robolectric package and maven groupId.
Changes coming soon:
- Removing many more shadows (most non-JNI Android classes should work without much shadowing).
- Switching from javassist to ASM for faster startup.
- Easier TestRunner setup and configuration.
- Performance and memory use improvements.
Use it!
<dependency> <groupId>org.robolectric</groupId> <artifactId>robolectric</artifactId> <version>2.0-alpha-1</version> </dependency>Add a @RunWith to your test class and you're ready to go!
@RunWith(RobolectricTestRunner.class) public class MyActivityTest { ... }
Upgrading:
If you're upgrading from Robolectric 1.x, you'll need to replace any reference to "com.xtremelabs.robolectric" in your project with "org.robolectric".
If you have a custom TestRunner, you'll need to change its configuration somewhat. We're expecting the custom TestRunner API to change soon.
Help:
If you find bugs, make an issue on our github project and label it with robolectric-2.
Really good news. We've spotted already some test failures after migrating, but it seems like most of the things work. Soon we will report any problems we find.
ReplyDeleteThanks a lot for this alpha! I hope Final Release is coming really soon :-)
Hoping to make this a quick release cycle, yep! Look forward to your bug reports!
DeleteYEEEEEESSSSSSSSS!!!!!!!
ReplyDeleteThanks a ton fellas, awesome work.
I'm trying to use this version to run tests via maven/intelliJ, but it fails to find the AndroidManifest (as intellij runs from project root location).
ReplyDeleteIn previous versions we'd create a custom test runner and set the path, but I see this 2 arg constructor is now removed, how do I go about this now?
Thanks
Are the any examples out there of testing Fragments? Or is it still not fully supported?
ReplyDeleteExpect a new alpha release shortly which should have better fragment support.
ReplyDeleteGood news. Thank you. www.mobengineers.com
ReplyDeleteBài viết rất hay: Chúng tôi chuyên cung cấp các sản phẩm chất lượng sau:
ReplyDeleteLều xông hơi tại nhà
Lều xông hơi hồng ngoại
Cảm ơn các bạn!