记录两个InstantApp模块的Espresso测试 [英] Record Espresso Test For Two InstantApp Modules
问题描述
问题:来自一个模块(base
)的Instantapp活动调用了来自另一个模块(my_feature
)的活动.两者都应使用Android Studio中的"录制Espresso测试"进行测试.
PROBLEM: An instantapp activity from one module (base
) calls activity from another module (my_feature
). Both should be tested using 'Record Espresso Test' in Android Studio.
RESEARCH:为非即时应用程序生成的Espresso代码在这两个活动中均具有R.id.component
引用.在即时应用生成的代码中,范围中仅来自第一个模块的引用.因此,您无法从另一个模块的活动中访问组件.
RESEARCH: Espresso-generated code for non-instant application has R.id.component
references on both activities. In an instant-app generated code only references from the first module are in the scope. So you can't access components from an activity of another module.
问题:如何在Espresso中测试模块间操作?
QUESTION: How to test inter-module actions in Espresso?
在Google上打开了一个错误问题: https://issuetracker.google.com/u/4/issues/77502630
Opened a bug issue at Google: https://issuetracker.google.com/u/4/issues/77502630
推荐答案
就错误没有动静而言,我使用 Appium 解决了问题强>.可以集成到Android Studio测试中,尽管应该在系统中保持平行的Appium窗口打开.
As far as there is no movement on the bug, I've resulted with a workaround, using Appium. It can be integrated into Android Studio tests, though a parrallel Appium window should be kept open in your system.
Appium是基于Selenium Web Driver的高级测试框架.因此,它不使用Espresso之类的Android项目资源,并且允许进行跨功能测试.此外,它允许跨应用测试,并通过Android系统的消息,设置,电源,蜂窝信号和其他功能测试您的应用集成.
Appium is a higher-level testing framework on base of Selenium Web Driver. So it doesn't use Android Project Resources like Espresso and allows cross-feature testing. Moreover it allows cross-app testing and testing your app integractions with Android System messaging, settings, power, cellular signal and other features.
这是有关如何通过Android Studio测试设置Appium的详细说明.
Here is a detailed instruction on how to setup Appium with Android Studio testing.
这篇关于记录两个InstantApp模块的Espresso测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!