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 应用编写测试
基础教程推荐
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01