android-intent - Android espresso 匹配意图与 bundle 内的 bundle

标签 android-intent android-espresso android-testing hamcrest

我正在尝试匹配 bundle of bundle ( see image ) 中的值。

我需要验证 uriString="file:///storage/emulated...." 是否已设置。

但到目前为止,使用我的代码,我最多只能验证 value[1]="Benefits Card provided by"

intended(IntentMatchers.hasExtras(BundleMatchers.hasValue(hasExtras(BundleMatchers.hasValue("test - Prescription Card")))));

最佳答案

虽然这是旧的并且可能已经解决了,但我认为尝试使用 hasExtras 是值得注意的。连同嵌套 hasEntry .

对于嵌套包,如 -> extras: [Bundle[{key=Bundle[<more data>]}]] 可以试试 -> hasExtras(hasEntry(<key>), hasEntry(<key>, <arg>))

关于android-intent - Android espresso 匹配意图与 bundle 内的 bundle ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40900334/

相关文章:

android - 为什么 PendingIntent 不发回我的 Intent 自定义 Extras 设置?

android - 通过集成到您的应用程序中的 ZXing 获取 QR 扫描结果

android - 用 Espresso 测试 Snackbar 节目

Android 在每次测试开始时撤销权限

java.lang.RuntimeException : Stub! - Android 代码覆盖率?

android - 使用 startActivityForResult,如何在子 Activity 中获取 requestCode?

java - WebView - 无法添加窗口 - token null 不适用于应用程序

android - 对于 Android GUI 自动化测试,AndroidViewClient/Culebra 相对于 Espresso 有哪些缺点?

android - 使用 Espresso 和模拟数据源进行测试失败

android - Robolectric 3 的图书馆资源 - JodaTime