Skip to content
arsduo edited this page Jun 30, 2011 · 18 revisions

Koala has full test coverage!

That’s right, you can sleep soundly tonight.

The tests are written in RSpec and can be run by calling

bundle exec rake spec

from anywhere in the Koala project directory.

By default, these tests run against mock responses and hence are ready out of the box.

Live tests

You can also run the tests live against Facebook’s servers for the ultimate verification:

LIVE=true bundle exec rake spec

The tests will post to your wall (be forewarned) but they’ll also clean up after themselves; we’ve run them dozens of times without leaving a trace.

Test Data

Data for the mock tests

The mocked tests rely on the default values from facebook_data.yml, excepting the values for access_token and OAuth code, which are stubbed; if you change those values the mock tests may fail. (In the near future, that data will be split out into a separate yml from the data used for live tests.)

Data for the live tests

Since we’re using the Facebook API for the live tests, we have to play by the rules of the Facebook API. Unfortunately, that means using information that sometimes expires. To run the live tests, you have to provide some of your own data: a valid OAuth access token with publish_stream and read_stream permissions, an OAuth code that can be used to generate an access token, and several other pieces as specified in the spec/facebook_data.yml file.

You can get these data at the OAuth Playground, or, if you want to use your own app, remember to swap out the app ID, secret, and other values. (The file also provides valid values for other tests, which you’re welcome to swap out for data specific to your own application.)