No description, website, or topics provided.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

XKCD API tests

General smoke tests for the XKCD JSON API. This is a general example on how you can use CasperJS to help automate API tests and reduce manual effort.


First you will need to install PhantomJS, the 2.1.1 release (or newer) is preferred. Once you have downloaded the binary, symlink this to /usr/local/bin/phantomjs.

Next is CasperJS, you can git clone this repo

git clone
git checkout 1.1.1

Then symlink the bin/casperjs script to /usr/local/bin/casperjs.

You can verify this works by running:

casperjs --version
phantomjs --version

From anywhere (as these should now be on your path).

Run the tests

This is simple.


You can also test the TEST site instance with

./ -e=TEST

CasperJS will report success or failure at the end of the test run. Tests can take upwards of 1 minute to run (depending on site speed).


You can run the script with an optional parameter to get CasperJS debug output.

./ -v

Example output

Example output from CasperJS

Read more

I wrote a blog post on this framework, where I attempt to explain some of the features of the testing framework and why you might want to use it.