我希望在不重置其状态的情况下测试我的 android 应用程序。我注意到每次运行该应用程序时都会出现不同的弹出窗口,因此我希望记录所有不同的弹出窗口。
我在这里对“运行”的定义是点击手机上的后退按钮,然后再次点击我的应用程序图标。
但是,我无法在我的 Appium 测试中模拟手机的这种物理敲击。我可以退出我的第一个测试,但我无法再次重新打开我的应用程序。 (模拟手指点击应用图标)
我尝试过的事情:
1. Setting noReset to true in capabilities setting
2. Using uiautomator to find my application. However, uiautomator doesn't seem to be able to detect any icons in the app menu page. It just shows many layers of frame layouts.
3. closeApp() and launchApp() resets the application and this defeats the purpose of my test. My application somehow behaves differently with each run so I hope to run my test in a single session (i.e. closing and opening the application while it is still in the same state)
有没有办法用代码的形式模拟物理点击图标?我知道我们可以设置坐标,但我不想将我的测试硬编码为仅在手机的特定实例上运行。如果卸载其他应用程序并且我的应用程序图标移动到另一个位置,它将不会运行。
最佳答案
这对我有用:
"appPackage": "com.company.app",
"appActivity": "com.company.app.activities.HomeActivity",
"skipDeviceInitialization": true,
"skipServerInstallation": true,
"noReset": true
这不会重新安装 .apk、appium 服务器,也不会删除 appdata。在开始测试之前,您可以像离开时一样启动该应用。
我发现这个在 GitHub 上浏览相同的问题:
关于java - 使用 Appium 和 Selenium WebDriver 在不重置其状态的情况下测试 Android 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37781823/