last update : March 24, 2011
One of the hard things about developing on the Facebook Platform has been testing applications. Facebook’s Terms of Service require that all accounts be linked to your real identity, so it’s not allowed to make fake accounts to test things with.
In the past, Facebook formalized the concept of test accounts with a procedure to convert a real account to a test account with an affiliation to the Facebook Platform Developer Test Accounts network. The test account status could be removed from a Network Settings page.
My past test accounts were :
- Alice Paris (français) : uid = 1589435275
- Hans Berlin (deutsch) : uid = 100000006032142
- Jerry London (english) : uid = 1776326306
These three users were friends.
In November 2010, Facebook launched a new concept of test users for manual or automated testing. A test user is a user account associated with an application created for the purpose of testing the functionality of that application. The test account can be accessed via a login_url which allows you to directly login to the account. The login_url expires after one hour, but you easily refresh it to get a new login_url for the same test user. An access_token for the test user is provided so that you can take actions on behalf of the test user via the api. An application can create up to 100 test users to start testing an application.
More details are available at the Facebook Test Users webpage.
A test account related to a Facebook application is created with a POST request :
Special permission requests (offline-access, stream-read, …) can be added to the POST message.
A user_id, a user_access_token and a user_login_url are returned. The profile page of the test-user is accessed through the login_url. The profile can be completed, modified and managed like a real Facebook profile, but interaction with real users is not possible. A fictive name is attributed to the test user by the Facebook test platform.
The token and the login expire on first use or after one hour whichever happens first. Created test users can be refreshed with a GET request asking for all test users associated to a given application.
A new user_access_token and user_login_url for all user-id’s are returned.
A maximum of 100 test-users for one application can be created. Existing test-users can bet associated with another Facebook application with the POST request
Friend connections can be created manually at the profile page or by script with the POST request and accept messages
A test user can be deleted with the HTTP DELETE request or with a POST request
https://graph.facebook.com/<test_user_id>?method=delete&access_token=<token test_user or token app_id>
Several developpers published their scripts to handle the Facebook Test Users :