使用Selenium测试Facebook Connect应用程序?(Testing a Facebook Connect application using Selenium?)

编程入门 行业动态 更新时间:2024-10-23 10:22:01
使用Selenium测试Facebook Connect应用程序?(Testing a Facebook Connect application using Selenium?)

有没有人有使用Selenium自动测试使用Facebook Connect进行用户登录的Web应用程序的经验? 你推荐的任何提示或方法?

Does anyone have experience using Selenium to automate testing of a webapp that uses Facebook Connect for user login? Any tips or methods that you recommend?

最满意答案

取决于你想要做什么?

你会使用一个真正的Facebook用户(这是通过Facebook验证的电话)?

最安全和最可靠的,但非常困难( 不可能 )收集“真实”的用户(手机通过FB验证)。

在定义用户/连接细节的方面,如教育历史,工作历史,姓名,年龄等(特别是如果你没有访问所有“真实”的Facebook帐户)。

为测试应用而创建的假Facebook用户(未通过Fb验证)?

可能最容易设置,因为所有人都是假用户,不需要电话验证(使用FB)。 但是需要创建所有用户的电子邮件ID。

即使连接信息可以根据您的喜好量身定制。 主要缺点之一(它发生在我身上)是,如果Fb检测到用户不合法,FB会冻结所有帐户。 这将使你所有的Fb 用户特定的自动化测试在眨眼之间变得毫无用处。 并且你没有太多可以做的事情(除非你打算获得一个全新的电话连接来验证这些账户,没有谷歌号码,没有Skype,也没有基于IP的电话,FB对此非常严格)。 另外一个号码只能授权一个帐号。

你会使用Facebook API创建Fb测试用户吗?

可能最理想的方式(根据FB)使用Facebook连接来测试你的应用程序。 点击这里查看如何使用它的文档。

这看起来很简单,但它有其不足之处(主要的)。 非常不可靠,API返回10-20%的错误时间,并且极其缓慢。 没有办法检索FB测试用户的密码,如果放错了一次。 连接信息不容易定制。 需要付出相当大的努力来设置一些东西,而不是每次都确定它是否有效。

我亲自选择了第二个选项。 Facebook根据跨多个ips的并行登录检测用户的合法性(我猜)。 我有各种服务器上运行的硒RC,这些服务器并行运行这些测试,可能会引发红旗。 所以我只是以更有组织的方式安排这些脚本,以避免登录重叠。

我希望在这个漫长的解释中找到你的答案。 :)


对于perl实现 -

$sel->start(); $sel->open_ok("$URL"); $sel->set_speed("500"); $sel->click_ok("//img[\@alt='Facebook']",'User clicks on Facebook Login'); $sel->wait_for_pop_up_ok("", "30000",'Facebook Login Popup Loading'); $sel->select_pop_up("null"); $sel->type_ok("email", "email\@email.com",'User enters Facebook credentials - Username'); $sel->type_ok("pass", "password",'User enters Facebook credentials - Password'); $sel->key_press("pass", "\\13",'User returns Facebook Login credentials'); $sel->select_window("null");

Depends what you want to do?

Will you be using a real-real Facebook User (which is phone verified by Facebook)?

Safest and most reliable ,but very difficult (impossible) to gather "real" users (phone verified by FB).

In terms of defining aspects of the user/connections details, like education history, work history, name, age etc(specially if you do not have access to all the "real" facebook accounts).

Fake facebook users created for testing the app (not verified by Fb)?

Probably the easiest to setup, as all are fake users, no Phone verification(with FB) required. But email ids for all users would need to be created.

Even though the connection info can be tailored to your liking. One of the main drawbacks(and it has happened to me), is if Fb detects the user is not legit, FB would freeze all accounts. Which would make all your Fb user specific automated tests all useless in the blink of an eye. And there is not much you can do(Unless you plan to get a brand new phone connection to verify those accounts, no google number, no skype, no ip based phones allowed. FB is very strict with that). Also one number can authorize only 1 account.

Will you be using the Facebook APIs to create Fb test users?

Probably the ideal way (according to FB)to use Facebook connect to test your app. click here for documentation on how to use it.

It may seem straight forward, but it has its downfalls(major ones). Very un-relaible, the API returns an error 10-20% of the time, and extremly slow the other times. No way to retrieve the password of a FB test user if misplaced once. Connection info cannot be easily customized. A fair amount of effort required to set it up something without being sure it work each time.

I have personally opted for the second option. Facebook detects the legitimacy of the user (I guess) based on parallel logins across multiple ips. I have selenium RCs running across various servers, which run these tests in parallel, which could have possibly raised a red flag. So i just schedule these scripts in a more organized manner, so as to avoid login overlaps.

I hope in this long explanation you find your answer. :)


For the perl implementation -

$sel->start(); $sel->open_ok("$URL"); $sel->set_speed("500"); $sel->click_ok("//img[\@alt='Facebook']",'User clicks on Facebook Login'); $sel->wait_for_pop_up_ok("", "30000",'Facebook Login Popup Loading'); $sel->select_pop_up("null"); $sel->type_ok("email", "email\@email.com",'User enters Facebook credentials - Username'); $sel->type_ok("pass", "password",'User enters Facebook credentials - Password'); $sel->key_press("pass", "\\13",'User returns Facebook Login credentials'); $sel->select_window("null");

更多推荐

本文发布于:2023-08-05 08:53:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1431153.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应用程序   测试   Facebook   Selenium   application

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!