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 应用编写测试
- 想使用ViewPager,无法识别android.support.*? 2022-01-01
- 用 Swift 实现 UITextFieldDelegate 2022-01-01
- Android - 拆分 Drawable 2022-01-01
- Android viewpager检测滑动超出范围 2022-01-01
- MalformedJsonException:在第1行第1列路径中使用JsonReader.setLenient(True)接受格式错误的JSON 2022-01-01
- Android - 我如何找出用户有多少未读电子邮件? 2022-01-01
- 如何检查发送到 Android 应用程序的 Firebase 消息的传递状态? 2022-01-01
- 使用自定义动画时在 iOS9 上忽略 edgesForExtendedLayout 2022-01-01
- android 4中的android RadioButton问题 2022-01-01
- 在测试浓缩咖啡时,Android设备不会在屏幕上启动活动 2022-01-01
