Recently, I had to use Facebook API for a web site using social networks. When testing these APIs, having test accounts is necessary. Facebook provides an API to create, delete and modify these friends. Here is a handy code snippet which makes it easy to batch create, delete, list test accounts and connect them as friends.
A zipped version is attached below.