android / android/testing-samples

Not compiling test class with a fragment that not inherits directly but indirectly from Fragment class

オープン
#503 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Java
スター
9.3k
フォーク
3.6k
PR マージ指標
30日以内にマージされた PR はありません

説明

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

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

FiltersFragmentTestのエントリポイントとモジュール依存関係の宣言から始め、launchFragmentInContainerのコンパイルを再現し、解決されたandroidx.fragmentのバージョンを確認します。Fragmentが間接的に継承されている場合にテストがコンパイルされるかを確認し、結果を決定する依存関係/バージョンの状態を記録します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
android, kotlin
領域
mobile-dev, testing
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。