Click here to skip to this page's main content.

New Feature: You can now embed Open Library books on your website!   Learn More
Last edited by raj
January 14, 2014 | History

BookReader Testing

BookReader Testing (Currently IA-specific)

Unit Tests

The BookReader unit tests live under BookReaderIA/test (the first set of tests is mostly for IA-specific backend functionality). The tests are written using QUnit.

Setting up symlinks

This assumes you have the following trees checked out:

  • petabox SVN tree in ~/petabox
  • BookReader git repository in ~/bookreader
  • BookReader Tools repository in ~/tools

Create the symlinks:

$ ln -s ~/bookreader ~/public_html/bookreader # To give access to tests
# For use on datanodes, e.g.
$ ln -s ~/petabox/www/datanode/BookReader ~/public_html/BookReader
# Create symlinks to your git working dir from petabox tree
$ ~/tools/ -l

Your username must be known inside the serverBaseURL function in petabox/www/common/

You should now be able to run your working copy of the BookReader code, e.g. for the testflip user:

An example image URL would be:

An example of a texts item with many sub-books:

Running the unit tests

With the above setup you should be able to access the tests from your home directory:

You should see your test host listed next to "BookReader QUnit Tests" at the top of the page.

You can run the tests matching a given string:

Adding tests

New tests can be added by modifying or creating a file inside BookReaderIA/test/unit. The script should be added to BookReaderIA/test/index.html.

Pulling changes into the testing account (testflip)

You should have access to the ~testflip account (e.g. by having your SSH public key in ~testflip/.ssh/authorized_keys.

mang@home:~/bookreader$ git commit
mang@home:~/bookreader$ ssh -A
testflip@home:~$ cd petabox/
testflip@home:~/petabox$ svn up
testflip@home:~$ cd bookreader/
testflip@home:~/bookreader$ git remote -v show
origin  /home/mang/bookreader/.git
testflip@home:~/bookreader$ git fetch origin
testflip@home:~/bookreader$ git checkout origin/master
HEAD is now at 4a23cee... Fix race condition in select call.  Fix fallback code so it properly determines available reduction levels from JP2s.
testflip@home:~/bookreader$ ~/tools/ -l --force
Linking files in ~/bookreader/BookReader to ~/petabox/www/sf/bookreader

You can now be able to see your changes on www-testflip and you can send the URL to QA:

Deploying changes

See BookReader Deployment for instructions on deploying changes and tagging the release on github.

History Created August 12, 2010 · 9 revisions

January 14, 2014 Edited by raj fix broken formatting
January 14, 2014 Edited by raj Add link to SubBookTest item
August 12, 2010 Edited by mangtronix Edited without comment.
August 12, 2010 Edited by mangtronix Edited without comment.
August 12, 2010 Created by mangtronix Documentation on unit tests