android / android/testing-samples
Not compiling test class with a fragment that not inherits directly but indirectly from Fragment class
- Vorherrschende Sprache
- Java
- Sterne
- 9.3k
- Forks
- 3.6k
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
I'm working with this code:
```
@RunWith(AndroidJUnit4ClassRunner::class)
class FiltersFragmentTest {
@Test
fun fragmentIsVisible() {
val scenario = launchFragmentInContainer()
scenario.recreate()
Espresso
.onView(ViewMatchers.withId(R.id.jvQuery))
.check(matches(isDisplayed()))
}
}
```
The FiltersFragment class inherits from a class custom, that inherits from another custom base fragment class that inherits from Fragment (androidx.fragment.app.Fragment). But when trying to execute the test an error is shown in compile time
Cannot access class 'androidx.fragment.app.FragmentFactory'. Check your module classpath for missing or conflicting dependencies
Type argument is not within its bounds: should be subtype of 'Fragment'
I see in my project dependencies two versions of fragment library: 1.3.6 for appCompat library use and direct dependency 1.6.2
Both have FragmentFactory class inside
Beitragsleitfaden
Rechercherichtung
Beginne mit dem FiltersFragmentTest-Einstiegspunkt und den Deklarationen der Modulabhängigkeiten; reproduziere die Kompilierung von launchFragmentInContainer und prüfe die aufgelösten androidx.fragment-Versionen. Bestätige, ob der Test kompiliert, wenn Fragment indirekt geerbt wird, und dokumentiere den Abhängigkeits-/Versionszustand, der das Ergebnis bestimmt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- android, kotlin
- Bereich
- mobile-dev, testing
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 35/100