-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Update to Robolectric 2.3 #984
Update to Robolectric 2.3 #984
Conversation
Initial implementation for upgrading to Robolectric 2.2. SaveInstanceStateActivityParameterizedTest is failing, which is due to a Robolectric bug described in androidannotations#973. This commit dependes on RoboGuice 2 which is implemented in androidannotations#983. All other tests should be OK. This involves lots of code change and simplification thanks to Robolectric 2.2.
The ParameterizedRobolectricTestRunner has a problem: when creating the test parameter objects, it uses the default ClassLoader, but for the tests it uses the Robolectric ClassLoader. This results in errors since objects cannot be used altogether which are originating from different ClassLoaders. This commit fixes this issue by creating a workaround class which loads Robolectric with a fake test, aquire the Robolectric ClassLoader and creates the test parameter objects with that.
|
I managed to create a workaround, so now all tests run correctly. Please review this PR as soon as you can because it is difficult to update it every time if the other contributors still use Robolectric 1. |
|
👍 for reviewing quickly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you comment out @Roboguice and let this Activity extends RoboActivity ?
The purpose of @Roboguice is to prevent the user from having to let their Activity extends RoboActivity.
|
I've made a review of this PR and it seems great. |
|
Thanks for the review. As you can see, i also updated RoboGuice support to version 2. I commented out the annotation because it was not working yet, etc, but i forgot to re-add it. Now i finished #983 so the tests are running in conjunction with that PR. |
|
Robolectric 2.3 just has been released. I think i'll update this PR to use the new version. @yDelouis, @DayS do you agree? |
|
Why not. |
|
I updated to PR to use Robolectric 2.3. The workaround had to be modified a little because the crucial fields in |
Robolectric 2.3 was just released, so this commit upgrades to the latest version. Since Robolectric only works with API level 16 and up, the test app project and the test project now uses that.
@yDelouis > Yeah.. Sorry about that :x @WonderCsabo > Did you try to launch a
|
|
Of course. As i already told to @yDelouis, this PR works in conjunction with the RoboGuice 2 PR. |
|
Oops, I forgot about that, sorry. I'm reviewing this right now |
|
Great job 👍 Thanks a lot for this |
|
Thanks! Now i can merge the two test projects. :) |
Implements #973.
This is not done, because there is an issue with
ParameterizedRobolectricTestRunneras noted in #973, but i push it here so code review and ideas around the bug can be started.Also this PR is depends on #983.