-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
org.robolectric:shadows-supportv4 doesn't support Jetpack(androidx) #3985
Comments
Seeing this as well. Using the new
|
Interestingly if I run tests through Gradle directly (and not through Android Studio) they are fine. Could this be a problem with Jetifier? |
If you don't edit the whole project which means all package names of android.support.fragment to the androidx.app.fragment. |
Any news on this? Some of my tests are failing because of the "NoSuchMethodError" problem |
@sdetilly Actually I have done it by myself, here is one example: |
Have the same issue. I can't create a andoidx.fragment.app Fragment with Robolectric |
We actually have a replacement for Support FragmentController coming out
soon.
…On Mon, Oct 22, 2018, 9:50 AM Dimitri Simon ***@***.*** wrote:
Have the same issue. I can't create a andoidx.fragment.app Fragment with
Robolectric
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#3985 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AGBaeA_RJ9z6jlgugoLsUWHWUU6Q3p2Oks5unXingaJpZM4WTSVl>
.
|
@jongerrish any update on this? Or known workarounds? We've not been able to run any of our Fragment tests in Android studio because of this (but for some reason, as mentioned above, they still work on the command line). |
We have a new API for Fragments which should launch Monday and is compatible both for Instrumentation tests and local tests in Robolectric. |
@jongerrish any particular release date for it? |
@Sai-Deepthi It was released this week. More details here:- https://developer.android.com/training/basics/fragments/testing |
The new FragmentScenario library won't help with org.robolectric.shadows.support.v4.ShadowLocalBroadcastManager will it? Won't I still need the shadows-supportv4 dependency if I want to use ShadowLocalBroadcastManager? |
See the comment on #2849
"""
LocalBroadcastReceiver doesn't really need a shadow, tests could instead be
written to simply register a receiver that checks for broadcasts being sent.
"""
Is this a major issue for you? We'd prefer to delete that shadow, but we
don't want to make life difficult for you so if its a problem we can look
at producing an androidx version of the whole library.
…On Tue, 13 Nov 2018 at 10:47, Nick Butcher ***@***.***> wrote:
The new FragmentScenario library won't help with
org.robolectric.shadows.support.v4.ShadowLocalBroadcastManager will it?
Won't I still need the shadows-supportv4 dependency if I want to use
ShadowLocalBroadcastManager?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3985 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AGBaeGUXYIkGMFwekmvk44WlFjWXsW1lks5uuxOtgaJpZM4WTSVl>
.
|
I'm happy to try and remove my need for ShadowLocalBroadcastManager by following the advice in #2849. Thanks! |
Cool,
Please let us know if it causes you any problems. We've never marked
it @deprecated so we should support this migration for you, but I'd be
interested in your experience following the advice. It would be useful for
us to document the migration case for when we do deprecate it.
…On Tue, 13 Nov 2018 at 11:13, Nick Butcher ***@***.***> wrote:
I'm happy to try and remove my need for ShadowLocalBroadcastManager by
following the advice in #2849
<#2849>. Thanks!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3985 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AGBaeIUxWk26o_q7-W_y6lRgRjaj2rHnks5uuxnmgaJpZM4WTSVl>
.
|
No problems. I fixed my tests, as suggested, to register a LocalBroadcastReceiver which checks that the Intents that it receives match what the test cases are expecting. |
Definitely would have been a smoother transition to AndroidX if this worked... right now I've had to mark some tests as @ignore until I can rewrite them. They all use |
@XinyueZ @seadowg @sdetilly @userdimi I met this issue too, so I just created this clones: https://github.com/nimbl3/robolectric.shadows-supportv4, it helps support current tests using |
Hey @XinyueZ @seadowg @sdetilly @userdimi, You can use See Official doc: https://developer.android.com/training/basics/fragments/testing |
@luongvo Thank you very much for the library! it helps alot! @KevinLeigh I think i will wait until |
Hi all, Any update on this issue? |
Issue: "org.robolectric:shadows-supportv4:{latest_version}" library This library from Robolectric doesn't support AndroidX and internally uses support-v4 package. Reference Issue: robolectric/robolectric#3985 Temporary Resolution: As a workaround I've switched to using a clone of this library which supports AndroidX. Inspiration taken from here: robolectric/robolectric#3985 (comment) Actual Resolution: If this passes our tests, a future task should be created to start using FragmentScenario from package -> androidx.fragment:fragment-testing Official Doc: https://developer.android.com/training/basics/fragments/testing
Issue: "org.robolectric:shadows-supportv4:{latest_version}" library This library from Robolectric doesn't support AndroidX and internally uses support-v4 package. Reference Issue: robolectric/robolectric#3985 Temporary Resolution: As a workaround I've switched to using a clone of this library which supports AndroidX. Inspiration taken from here: robolectric/robolectric#3985 (comment) Actual Resolution: If this passes our tests, a future task should be created to start using FragmentScenario from package -> androidx.fragment:fragment-testing Official Doc: https://developer.android.com/training/basics/fragments/testing
Issue: "org.robolectric:shadows-supportv4:{latest_version}" library This library from Robolectric doesn't support AndroidX and internally uses support-v4 package. Reference Issue: robolectric/robolectric#3985 Temporary Resolution: As a workaround I've switched to using a clone of this library which supports AndroidX. Inspiration taken from here: robolectric/robolectric#3985 (comment) Actual Resolution: If this passes our tests, a future task should be created to start using FragmentScenario from package -> androidx.fragment:fragment-testing Official Doc: https://developer.android.com/training/basics/fragments/testing
Issue: "org.robolectric:shadows-supportv4:{latest_version}" library This library from Robolectric doesn't support AndroidX and internally uses support-v4 package. Reference Issue: robolectric/robolectric#3985 Temporary Resolution: As a workaround I've switched to using a clone of this library which supports AndroidX. Inspiration taken from here: robolectric/robolectric#3985 (comment) Actual Resolution: If this passes our tests, a future task should be created to start using FragmentScenario from package -> androidx.fragment:fragment-testing Official Doc: https://developer.android.com/training/basics/fragments/testing
Issue: "org.robolectric:shadows-supportv4:{latest_version}" library This library from Robolectric doesn't support AndroidX and internally uses support-v4 package. Reference Issue: robolectric/robolectric#3985 Temporary Resolution: As a workaround I've switched to using a clone of this library which supports AndroidX. Inspiration taken from here: robolectric/robolectric#3985 (comment) Actual Resolution: If this passes our tests, a future task should be created to start using FragmentScenario from package -> androidx.fragment:fragment-testing Official Doc: https://developer.android.com/training/basics/fragments/testing
Issue: "org.robolectric:shadows-supportv4:{latest_version}" library This library from Robolectric doesn't support AndroidX and internally uses support-v4 package. Reference Issue: robolectric/robolectric#3985 Temporary Resolution: As a workaround I've switched to using a clone of this library which supports AndroidX. Inspiration taken from here: robolectric/robolectric#3985 (comment) Actual Resolution: If this passes our tests, a future task should be created to start using FragmentScenario from package -> androidx.fragment:fragment-testing Official Doc: https://developer.android.com/training/basics/fragments/testing
Issue: "org.robolectric:shadows-supportv4:{latest_version}" library This library from Robolectric doesn't support AndroidX and internally uses support-v4 package. Reference Issue: robolectric/robolectric#3985 Temporary Resolution: As a workaround I've switched to using a clone of this library which supports AndroidX. Inspiration taken from here: robolectric/robolectric#3985 (comment) Actual Resolution: If this passes our tests, a future task should be created to start using FragmentScenario from package -> androidx.fragment:fragment-testing Official Doc: https://developer.android.com/training/basics/fragments/testing
Issue: "org.robolectric:shadows-supportv4:{latest_version}" library This library from Robolectric doesn't support AndroidX and internally uses support-v4 package. Reference Issue: robolectric/robolectric#3985 Temporary Resolution: As a workaround I've switched to using a clone of this library which supports AndroidX. Inspiration taken from here: robolectric/robolectric#3985 (comment) Actual Resolution: If this passes our tests, a future task should be created to start using FragmentScenario from package -> androidx.fragment:fragment-testing Official Doc: https://developer.android.com/training/basics/fragments/testing
Issue: "org.robolectric:shadows-supportv4:{latest_version}" library This library from Robolectric doesn't support AndroidX and internally uses support-v4 package. Reference Issue: robolectric/robolectric#3985 Temporary Resolution: As a workaround I've switched to using a clone of this library which supports AndroidX. Inspiration taken from here: robolectric/robolectric#3985 (comment) Actual Resolution: If this passes our tests, a future task should be created to start using FragmentScenario from package -> androidx.fragment:fragment-testing Official Doc: https://developer.android.com/training/basics/fragments/testing
Issue: "org.robolectric:shadows-supportv4:{latest_version}" library This library from Robolectric doesn't support AndroidX and internally uses support-v4 package. Reference Issue: robolectric/robolectric#3985 Temporary Resolution: As a workaround I've switched to using a clone of this library which supports AndroidX. Inspiration taken from here: robolectric/robolectric#3985 (comment) Actual Resolution: If this passes our tests, a future task should be created to start using FragmentScenario from package -> androidx.fragment:fragment-testing Official Doc: https://developer.android.com/training/basics/fragments/testing
Issue: "org.robolectric:shadows-supportv4:{latest_version}" library This library from Robolectric doesn't support AndroidX and internally uses support-v4 package. Reference Issue: robolectric/robolectric#3985 Temporary Resolution: As a workaround I've switched to using a clone of this library which supports AndroidX. Inspiration taken from here: robolectric/robolectric#3985 (comment) Actual Resolution: If this passes our tests, a future task should be created to start using FragmentScenario from package -> androidx.fragment:fragment-testing Official Doc: https://developer.android.com/training/basics/fragments/testing
The Robolectric has removed shadows for v4 from 4.9. So I will close this issue. Feel free to reopen this issue if you have similar issues when running the latest Robolectric with AndroidX. |
@utzcoz is there any plan to provide Shadows for other (that Fragment) AndroidX component like |
I think not, at least from my part. The Robolectric focus on the main components of AOSP's frameworks, and AndroidX components are separate. If these components rely on AOSP's components, I think we can improve the shadow of the AOSP's one to fix issues for these AndroidX components. If not, users/developers can maintain the custom shadow for these components if needed. @hoisie What do you think? |
androidx libraries should not require shadows. If you find an androidx API that isn't testable I'd recommend filing an issue against androidx. |
Main repo: org.robolectric:robolectric:4.0-alpha-4-SNAPSHOT works with androidx
org.robolectric:shadows-supportv4 doesn't work, ie:
class TestSupportFragment extends androidx.fragment.app.Fragment
doesn't work ----->
SupportFragmentController.of(new TestSupportFragment())
any snapshot for shadows-supportv4 ?
issue
The text was updated successfully, but these errors were encountered: