简体   繁体   中英

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. 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/ ).

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. 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. 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.

What is the best practice of testing Facebook apps that involves exchange of data which primary user shares with other Facebook accounts.

It is probably best for unit testing purposes to not connect to Facebook at all. 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.

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. (I assume facebook has a limit on how many times you can query them per unit of time)

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM