简体   繁体   English

Facebook应用程序的测试帐户(例如,JUnit测试手册)

[英]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.

相关问题 有关使用的JUnit jar版本的Ant JUnit任务报告(例如Junit 3、3.8、4) - Ant JUnit task report on the version of the JUnit jar used (e.g. Junit 3, 3.8, 4) 测试失败时记录异常的最佳方法(例如使用junit规则) - Best way of logging exceptions when tests fail (e.g. using a junit rule) 如何为Android应用创建标题屏幕? 例如,当应用程序像Facebook一样加载时 - How do you create a title screen for an android app? E.g. When the app is loading like Facebook 有没有办法使用 skyve 验证器(例如电子邮件)来测试不是 bean 属性的值? - Is there a way to use a skyve validator (e.g. email) to test a value which isn't an attribute on a bean? 例如 thenReturn() 可能会丢失。 正确的存根示例:springboot 中的单元测试 - E.g. thenReturn() may be missing. Examples of correct stubbing: unit test in springboot 如何将Spring Boot中的application.properties文件外部化为外部依赖JAR? - How to externalize application.properties files in Spring Boot to e.g. external dependent JAR? eclipse 中是否有一个快捷键来启动(最喜欢的)外部应用程序,例如参数化的 maven 构建? - Is there a shortkey in eclipse to launch (favorite) external application e.g. parameterized maven build? 在Java应用程序中查看样式化文本(例如HTML)的最简单方法是什么? - What is the simplest way to view styled text (e.g. in HTML) in a Java application? 在Java中获取当前活动文件(不是Java应用程序,例如pdf)的完整路径 - Getting the full path of current active file (not a Java application, e.g. pdf) in Java 如何安全地为要启动的后台应用程序提供敏感信息(例如密码)? - How do you securely provide a sensitive info (e.g. password) to a background application to be started?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM