问题
I am working on an automated test script to create test users and connect them as friends with each other to load test and profile parts of my app.
The test user documentation states a limit of a maximum 500 test users per application. https://developers.facebook.com/docs/test_users/
An app can create up to 500 test users to start testing an app. If you exceed the limit of test users you can create for an app you will receive an error.
Anyone else out there ever needed to push past this limit, and how did you achieve testing with communities of users larger than 500? I want to test with users who have between 2000 and 3000 Facebook friends. Yes, such characters are out there in the real world :) Note: as per a comment below it is highly unusual to find users with such large numbers of friend connections. See the comment for a link to stats.
One option which I'm experimenting with is to create multiple apps and "friend" the test users between apps, which seems to be possible. This seems like unnecessary work though.
I'm also considering stubbing the Facebook API with my own local server, but this feels wrong too. There might be libraries for doing this easily?
回答1:
Since no one has answered this for quite a while, I thought I'd just post the way I solved this for now, in case someone else needs it some day.
Facebook allows you to add and "share" test users between multiple apps for which you are an administrator.
Therefore, I created several extra test Facebook apps for myself, besides the one I am already testing.
Then I added almost 500 test users to each (using the create test user API call).
I then associated some existing "core" test users across all the apps from the original test application (see below for documentation on how to do this) taking the additional apps up to their 500 limit.
Once the "core" users were added across all the test apps, I then made the "core" users friends with all the other users in each test app (this needs to be done within each test app - ie using the access tokens of the additional test app, not the original app).
The final result is that the "core" group from the original app are friends with users from outside the original app, allowing their friend list to grow beyond the artificial testing user limit of 500. So from the original app I now have a collection of core users who can have as many friends as I'm prepared to go to the hassle of creating, in batches just under 500 in size.
There might be an easier way, but that's it for now.
I didn't explore the idea of stubbing the Facebook API - still an interesting idea!
From the documentation:
Adding existing test users to other apps
You can add existing test users to other apps by using the Graph API with the app access token that you're adding the user to.
https://graph.facebook.com/APP_ID/accounts/test-users? installed=true &permissions=read_stream &uid=TEST_USER_ID &owner_access_token=APP_ACCESS_TOKEN_OWNER &access_token=APP_ACCESS_TOKEN &method=post Parameters:
uid : User id of the existing test user
owner_access_token : App access token of the app used to create the test user
Facebook Test Users Documentation: http://developers.facebook.com/docs/test_users/
来源:https://stackoverflow.com/questions/10364579/limit-of-500-test-users-per-facebook-app-should-i-stub-the-facebook-api-for-au