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.

Usage

First let's start by creating a network of 5 friends.

$ geppetto create 5 --networked

For each user, you will get a login_url, id and access_token. The 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.

posts/fb_new_user.png

A new test user. Test users seem to always be female.

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

posts/fb_status_update.png

A new status update.

Let's engage in some social interactions. Each user will comment and like each other's posts.

$ geppetto generate_comments
$ geppetto generate_likes

posts/fb_like.png

Liking and commenting.

You can also create and upload "photos".

$ geppetto generate_images

posts/fb_photo.png

A photo is posted.

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.

Installation

Via Ruby gems.

$ gem install geppetto

or head over to Github and fork Geppetto.

https://github.com/ternarylabs/geppetto