Writing tests for an Android app that logs into Facebook(为登录 Facebook 的 Android 应用编写测试)
问题描述
我的 Android 应用使用 FacebookSDK 进行登录.这是第一个屏幕,除非您登录,否则您无法进行任何操作.
My Android app uses FacebookSDK for login. It's the first screen, and you can't do anything unless you login.
我想编写一些 Espresso 测试以在 Greenhouse 持续集成服务器上运行.
I want to write some Espresso tests to be ran on Greenhouse Continuous integration server.
我在 iOS 上搜索并找到了 FBSDKTestUsersManager,但在 Android 上没有类似的东西.
I searched and I found FBSDKTestUsersManager on iOS, but nothing similar on Android.
What I plan to do is create a flavor of test and when that flavor is selected instead of a normal Facebook login button, I'd display a button that gets a test access token for the user, then brings them to the homepage的应用程序.但是,我不能这样做,因为 Android 上不存在 FBSDKTestUsersManager.
What I plan to do is create a flavor of test and when that flavor is selected instead of a normal Facebook login button, I'd display a button that gets a test access token for the user, then brings them to the homepage of the app. However, I can't do that cause FBSDKTestUsersManager doesn't exist on Android.
有什么建议吗?
推荐答案
解决方案是将 UIAutomator 与 Espresso for Android 一起参与您的测试.可以在测试环境下离开您的应用程序并在 Facebook 登录对话框上执行一些操作.类似的问题这里和我的博文.
The solution is to involve UIAutomator in your tests together with Espresso for Android. It will be possible to go outside of your app under test context and perform some actions on Facebook login dialog. Similar question here and the example in my blog post.
这篇关于为登录 Facebook 的 Android 应用编写测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:为登录 Facebook 的 Android 应用编写测试
基础教程推荐
- 如何将多个组件添加到 PickerView? 2022-01-01
- 在 Android 模拟器中激活网络位置提供程序? 2022-01-01
- Android:STATE_SELECTED不工作 2022-01-01
- 在 iOS8 中无法获得正确的键盘高度值 2022-01-01
- 突出显示朗读文本(在 iPhone 的故事书类型应用程序中) 2022-01-01
- 在 appComponent dagger 2 中动态添加测试模块? 2022-01-01
- 可可/目标C(OSX不是iOS)从子对象访问父对象 2022-01-01
- - (CGRect)convertRect:(CGRect)rect toView:(UIView *)view 如何工作 2022-01-01
- 我的 UIImageView 的任务 2022-01-01
- 新的@SystemApi 注解是什么意思,和@hide 有什么区别 2022-01-01
