[英]Test accounts for Facebook application (e.g. for manual of JUnit testing)
I am building application that uses Facebook services JSON API to get and update information for one account. 我正在构建使用Facebook服务JSON API来获取和更新一个帐户信息的应用程序。 There is celar policy how to upgrade my personal account to developer account https://developers.facebook.com/docs/create-developer-account/ That is clear (althout it is worse than it had been previously, eg http://answers.oreilly.com/topic/483-how-to-create-a-facebook-test-account/ ). 有一项天才政策,即如何将我的个人帐户升级为开发者帐户https://developers.facebook.com/docs/create-developer-account/很明显(尽管比以前更糟,例如http:// answer.oreilly.com/topic/483-how-to-to-create-a-facebook-test-account/ )。
The question is - how to legally creat other Facebook accounts to test such the data excahnge for features like Facebook events, friendships and so on. 问题是-如何合法地创建其他Facebook帐户以测试诸如Facebook事件,友谊等功能的数据交换。 I guess that it could be better to create test account, fill them with necessary information that could remain for some time and then do eg Unit tests on such predefined, clear environment? 我想最好是创建测试帐户,向其填充必要的信息,这些信息可以保留一段时间,然后再在这样的预定义,清晰的环境中进行单元测试?
I have heard that there can be some kind of temporary Facebook test accounts. 我听说可能会有某种临时的Facebook测试帐户。 I such account exist, then this could be the solution as well - ie the setup phase of JUnit test suite could fill such account with the static data and afterwards the tests could be executed. 如果存在这样的帐户,那么这也可能是解决方案-即JUnit测试套件的设置阶段可以用静态数据填充该帐户,然后执行测试。
What is the best practice of testing Facebook apps that involves exchange of data which primary user shares with other Facebook accounts. 测试Facebook应用的最佳实践是什么,该实践涉及交换主要用户与其他Facebook帐户共享的数据。
It is probably best for unit testing purposes to not connect to Facebook at all. 对于单元测试而言,最好是根本不连接到Facebook。 Instead use a mock object that will return specific JSON data (that your will contain the feature you are testing) and run your tests on that. 而是使用模拟对象,该对象将返回特定的JSON数据(您将包含要测试的功能)并在其上运行测试。
This way you don't have to create fake Facebook accounts or worry about network connections being up or down or how many times you run your tests. 这样,您不必创建伪造的Facebook帐户,也不必担心网络连接是否正常或运行多少次。 (I assume facebook has a limit on how many times you can query them per unit of time) (我假设facebook在单位时间内可以查询多少次有限制)
This technique will also allow you to create situations that are either rare or hard to re-create if you were using actual Facebook accounts. 如果使用实际的Facebook帐户,此技术还可以使您创建很少或很难重新创建的情境。
You can later actually test connecting to Facebook as part of integration tests, but you won't need as many tests since the unit tests should cover all your use cases already. 您可以稍后在集成测试中实际测试连接到Facebook的步骤,但是您不需要太多测试,因为单元测试应该已经涵盖了所有用例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.