编写测试的一款Android应用,登录到Facebook的 [英] Writing tests for an Android app that logs into Facebook
问题描述
我的Android应用程序使用 FacebookSDK
登录。这是第一个屏幕,除非你登录你不能做任何事情。
My Android app uses FacebookSDK
for login. It's the first screen, and you can't do anything unless you login.
我想写一些居preSSO
测试是温室持续集成服务器上运行的。
I want to write some Espresso
tests to be ran on Greenhouse Continuous integration server.
我搜索,我发现FBSDKTestUsersManager在iOS上,但在Android上没有类似的。
I searched and I found FBSDKTestUsersManager on iOS, but nothing similar on Android.
我打算做的就是创建测试的味道,并且在选择,而不是一个正常的Facebook登录按钮的味道,我会显示一个按钮,为用户获取测试访问令牌,然后将它们带来的主页的应用程序。但是,我不能这样做,原因FBSDKTestUsersManager不会在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 of the app. However, I can't do that cause FBSDKTestUsersManager doesn't exist on Android.
有什么建议?
推荐答案
解决方案是UIAutomator在测试中以E preSSO为Android一起参与。这将有可能去您的应用程序之外的测试环境和执行的Facebook登录对话框一些行动。类似的问题<一href=\"http://stackoverflow.com/questions/27258872/uiautomator-running-with-es$p$psso/29122806#29122806\">here在我的博客文章的例子
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.
这篇关于编写测试的一款Android应用,登录到Facebook的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!