When you're doing any significant development against the Facebook api, testing your application can be challenging. Because of the nature of social networks, the content generated by the users is highly unpredictable. If you're expecting any kind of repeatability, you need to control your users and their behavior.
Fortunately, Facebook introduced not too long ago test users. Those users can easily be created, befriend each others and generate all sort of content on demand. The api to do so is straight forward and can be incorporated in unit tests.
Geppetto is a command line utility that exposes most of what's available in the api in an easy to use application. It's built on top of the excellent Koala ruby library to interface with Facebook api. Let's take a look at what you can do with it.
First let's start by creating a network of 5 friends.
$ geppetto create 5 --networked
For each user, you will get a
login_url is useful to view this user on the facebook.com site. Otherwise, you can simply use the
access_token to authenticate them within your own application.
960x]" width="573" height="375" alt="posts/fb_new_user.png">
To list all your test users, simply type:
$ geppetto list
Now it's time to create some content by having all the users in the network update their status.
$ geppetto generate_status
960x]" width="512" height="256" alt="posts/fb_status_update.png">
Let's engage in some social interactions. Each user will comment and like each other's posts.
$ geppetto generate_comments $ geppetto generate_likes
960x]" width="486" height="172" alt="posts/fb_like.png">
You can also create and upload "photos".
$ geppetto generate_images
960x]" width="508" height="295" alt="posts/fb_photo.png">
Geppetto provides a couple of shortcuts to populate content.
$ geppetto build
Will build a network of test users and generate posts, likes, comments and images.
$ geppetto frenzy
Frenzy mode will continuously generate random content until you terminate the application.
Via Ruby gems.
$ gem install geppetto
or head over to Github and fork Geppetto.