Skip to content
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

ATF used with FragmentScenario breaks testing process #25

Closed
niehusstaab opened this issue Jul 28, 2020 · 2 comments
Closed

ATF used with FragmentScenario breaks testing process #25

niehusstaab opened this issue Jul 28, 2020 · 2 comments

Comments

@niehusstaab
Copy link

Even the most simple of test app I can make is unable to use ATF at its latest version (at the same time as FragmentScenario anyway).
I made a simple demo project to repro the bug: https://github.com/niehusstaab/ATF_bug_demo/tree/master

Attempting to run a basic Espresso test that uses FragmentScenario always results in the following error:

java.lang.NoSuchMethodError: No virtual method shouldWaitForActivitiesToComplete()Z in class Landroidx/test/runner/AndroidJUnitRunner; or its super classes (declaration of 'androidx.test.runner.AndroidJUnitRunner' appears in /data/app/com.example.myapplication.test-up9qel7XQQdGcgyDX4V36A==/base.apk)
        at androidx.test.runner.AndroidJUnitRunner.addListenersLegacyOrder(AndroidJUnitRunner.java:442)
        at androidx.test.runner.AndroidJUnitRunner.addListeners(AndroidJUnitRunner.java:423)
        at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:391)
        at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2189)

Is this a library incompatibility? Or is there some other underlying issue w/in ATF?

@niehusstaab
Copy link
Author

I've dug in a bit more and managed to get ATF working in my sample (now updated). The issue is DEFINITELY some unknown incompatibility between FragmentScenario and and ATF. The error message is very unhelpful in understanding why.

I'm still not sure which lib is causing the issue, so I'll leave this open. However, I'm inclined to blame FragmentScenario since it's a newer lib and still has some other weirdness going on w/ it (e.g. not being able to import it with androidTestImplementation in gradle).

@niehusstaab
Copy link
Author

Turns out FragmentScenario needed another dependency:

debugImplementation 'androidx.fragment:fragment-testing:1.2.5'
debugImplementation 'androidx.test:core:1.3.0-rc01'              // this dep prevents error

See full resolution in the android-test repo:
android/android-test#704

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant