mig*_*uel 6 android android-fragments android-studio android-espresso dynamic-feature-module
有没有人想出如何使用 fragmentScenario Espresso 测试(应用程序的 Activity 位于基本模块中)单独测试动态功能模块中的片段。
我已经克服了几个问题,例如关于样式不是 Theme.Appcompat 和 Android Studio 没有运行的withId抱怨,但现在在运行时抱怨它R.id在片段的布局中找不到。
AndroidManifest.xml我通过在动态模块的文件夹中创建一个src/debug并放置以下内容来解决动态模块中仪器测试的问题:
<manifest xmlns:dist="http://schemas.android.com/apk/distribution"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.poc.auth">
<!-- Note that we replace here our delivery from `on-demand` to `install-time` and put on the debug
folder so in tests this performs as a monolithic application and avoid non found
errors. Note also that this manifest need to be in `debug` folder rather
than `androidTest` folder. See /sf/ask/1837149891/>
<dist:module
dist:instant="false"
dist:title="Feature Module Auth Test"
tools:node="replace">
<dist:delivery>
<dist:install-time />
</dist:delivery>
<dist:fusing dist:include="true" />
</dist:module>
</manifest>
Run Code Online (Sandbox Code Playgroud)
这将使应用程序在测试中作为整体工作,这对于本地和CI/CD小型仪器测试.apk非常有用。
如果您需要像此处建议的那样在端到端测试中测试交付本身,我不确定这是否会产生影响,但如果有影响,您仍然可以为端到端测试创建一种风格再次覆盖清单。
| 归档时间: |
|
| 查看次数: |
152 次 |
| 最近记录: |