android / android/testing-samples
Not compiling test class with a fragment that not inherits directly but indirectly from Fragment class
- Ngôn ngữ chính
- Java
- Star
- 9.3k
- Fork
- 3.6k
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
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
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu với điểm vào FiltersFragmentTest và các khai báo dependency của module; tái hiện việc biên dịch launchFragmentInContainer và kiểm tra các phiên bản androidx.fragment đã được phân giải. Xác nhận liệu test có biên dịch khi Fragment được kế thừa gián tiếp hay không, đồng thời ghi lại trạng thái dependency/phiên bản quyết định kết quả.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- android, kotlin
- Lĩnh vực
- mobile-dev, testing
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 35/100