We are trying to upgrade to Robolectric 3.1 from version 3.0 which has been very stable and predictable. We currently have 700 tests that take about 4 minutes to run. We use Dagger and have a TestModule that uses Mockito so we can mock our Activity/Fragment dependencies. After upgrading to 3.1, the tests are about 10 times slower or just hang indefinitely.
One thing we noticed is that Robolectric now seems to layout ViewGroups that it was not laying out before. In order to compensate for this, we were manually calling ViewGroup.layout() to test Activities/Fragments that use RecyclerViews, as suggested in this post - http://stackoverflow.com/questions/27052866/android-robolectric-click-recyclerview-item.
Can you confirm that this was changed in Robolectric 3.1 and if so, do you think it could cause tests to take significantly longer. Also, were there any other major changes to the library's internals that you think could cause memory/performance issues?
Yes there is a performance regression that has been fixed at head. We'll push out a 3.1.01 with the fix in it, making this a duplicate of #2328
Also yes, Robolectric now calls a layout pass as would real Android, with a call to "dispatchResized".
Great, thank you!