cost 100 ms
如何从测试 class 获取属性? FragmentScenario,浓缩咖啡 - How to get access to a property from the test class? FragmentScenario, Espresso

我想检查我的 editTextView 和属性字段 (crime.title)。 我如何从测试 class 中获取此字段? 那是我的测试 Class: 片段 Class 中有一段我的代码: 这是第 5 版 Big Nerd Ranch 指南中的任务之一。 他们建议使用 onFragment() fu ...

androidTest:针对 S+(版本 31 及以上)要求在创建 PendingIntent 时指定 FLAG_IMMUTABLE 或 FLAG_MUTABLE 之一 - androidTest: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent

我正在尝试在 androidTest 源集中运行 launchFragmentInHiltContainer。 在代码片段下方运行会导致标题中提到的错误。 Function launchFragmentInHiltContainer: 我试图通过以下解决方案解决问题: Android Lint: ...

Robolectric 启动一个有观察者的片段 - Robolectric start a fragment that has an observer

如何在使用 Robolectric 的测试 scope 中使用 LiveData 观察者启动片段分段 我的测试使用 RobolectricTestRunner,因此我可以在测试 scope 中启动片段。 尝试运行测试时出现以下错误。 我尝试在实例化 FragmentScenario 之前和之后将 M ...

单击 Item Inside recycler 视图时,如何在 viewpager2 中膨胀它们各自的片段? - On click of an Item Inside recycler view, how can Inflate their respective fragments inside viewpager2?

我有MyViewPager2适配器,其中包含四个 Fragment 和一个SemesterFragment ,其中包含 Recyclerview DepartmentRVAdapter 。 onItem 在回收器视图中单击我想移动到 viewpager2 中的相应片段我怎样才能实现以下描述? ...

通过使用 FragmentScenario 停止和恢复来测试 androidx.fragment 生命周期,onCreateView() 调用了两次,但此错误已在 1.3.1 中修复 - testing androidx.fragment lifecycle by stopping and resuming with FragmentScenario, onCreateView() called twice but this bug is already fixed in 1.3.1

我正在使用androidx.fragment:fragment-testing为我的应用程序编写仪器测试。 测试用例之一是检查所有底层逻辑在 Fragment 停止和恢复时是否正确运行,以模拟应用程序被最小化(主页按钮)并再次返回。 这些测试使用FragmentScenario.moveToStat ...

android 片段场景在创建小吃店期间崩溃 - android fragment scenario crashes during snackbar creation

我有 android 应用程序。 我正在使用片段场景编写测试来测试我的片段。 我的测试很简单,看起来像这样: 所以我点击了一些按钮,当点击这个按钮时,小吃栏是这样的: 但我收到以下错误: androidx.test.espresso.PerformException:执行“单击”时出错 - 在坐标 ...

片段测试,我缺少相当于 ActivityScenarioRule 的东西 - Fragment testing, I'm missing something equivalent to ActivityScenarioRule

我习惯于通过在 Espresso 测试中启动包含它的 Activity 来测试我的 Fragments。 这一直工作得很好,我已经能够通过添加到 ActivityScenarioRule(或 IntentsTestRule)的一些测试规则(例如 OkHttpIdlingResourceRule)来控 ...

片段 arguments 是 null 使用 launchFragmentInContainer - fragment arguments are null using launchFragmentInContainer

我正在为使用safeArgs和FragmentScenario的片段编写测试,但是当我使用fragmentArgs参数调用launchFragmentInContainer()时,我收到一个异常,说 arguments 是 null。 生产代码没有问题。 我的导航图: 我的测试: 当我尝试运行测试 ...

在 AndroidGradlePlugin 3.5.0 及更高版本上为动态功能模块使用片段测试库时构建失败 - Failed to build when using fragment testing library on AndroidGradlePlugin 3.5.0 and above for Dynamic Feature module

所以,我试图在动态功能模块中使用片段测试库androidx.fragment:fragment-testing:1.2.4 。 当我使用 Android Gradle Plugin (AGP) version 3.6.3时,它无法构建并出现错误 所以我很好奇并检查了codelab github并尝试 ...

FragmentScenario 无法按预期工作 - FragmentScenario doesn't work as expected

我使用的架构几乎与 Google 示例相同: GithubBrowserSample 。 这个字段被注入到我的片段 class 中: 在我所有的片段测试中,我得到了这个错误,它对应于通过注入实例化的字段: 当我使用 FragmentScenario 设置我的片段时会发生这种情况: 但是,当我在将 F ...

片段测试:只有创建视图层次结构的原始线程才能接触其视图 - Fragment testing: Only the original thread that created a view hierarchy can touch its views

我挣扎了一段时间,所以我决定在这里寻求帮助......我使用的架构几乎与谷歌示例相同: GithubBrowserSample 。 在我的一个片段(androidTest)的测试中,我遇到了这个错误: 当我将数据提交到我的 ListAdapter 时,这部分代码会出现此错误: 仅当列表不为空时才会出 ...

FragmentScenario 和嵌套的 NavHostFragments 在 Instrumentation 测试中没有按预期执行导航 - FragmentScenario and nested NavHostFragments don't perform navigations as expected in Instrumentation tests

我正在编写一个单独的 Activity 应用程序,它使用 Android 的导航组件来帮助导航和 Fragment Scenario 进行仪器测试。 在使用片段场景时,在实际应用程序导航行为和在仪器测试期间单独测试的片段行为之间使用后退按钮时,我遇到了性能差异。 在我的 MainActivity ...

仅在 JVM 上测试 AndroidX 片段(不启动模拟器/设备) - Testing AndroidX fragments on JVM only (without launching an emulator/device)

我正在寻找一种方法来对我的 AndroidX 片段进行单元测试,而无需在模拟器中启动片段。 Robolectric 允许我们对 JVM 中的活动运行单元测试,但我不确定 AndroidX 片段的等效方法是什么。 Google Android 最近推出了FragmentScenario ,它允许 ...

使用 FragmentScenario 测试片段时如何测试与菜单的交互 - How to test interactions with menu when testing fragments with FragmentScenario

我正在尝试使用 FragmentScenario 测试片段。 这个片段有自己的菜单。 操作栏上有一个添加图标,单击此菜单项会启动一个子片段,用户可以从中添加新项目。 所以我正在尝试测试这种行为。 但是,您可能知道,FragmentScenario 在 EmptyFragmentActivity 中启 ...


 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM