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

 Hello!   Open Library is participating in our eBook lending program. Browse the growing lending library of over 250,000 eBooks!

Site Search

Site Search
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. http://ia301514.us.archive.org:80/~testflip/BookReader/BookReaderImages.php?...
$ ln -s ~/petabox/www/datanode/BookReader ~/public_html/BookReader
# Create symlinks to your git working dir from petabox tree
$ ~/tools/arsync.py -l

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

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

http://www-testflip.archive.org/stream/goodytwoshoes00newyiala

An example image URL would be:

http://ia301514.us.archive.org:80/~testflip/BookReader/BookReaderImages.php?zip=/0/items/seasourknowledge49russ/seasourknowledge49russ_jp2.zip&file=seasourknowledge49russ_jp2/seasourknowledge49russ_0009.jp2&scale=4&rotate=0

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

https://archive.org/details/SubBookTest

Running the unit tests

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

http://www-testflip.archive.org/~testflip/bookreader/BookReaderIA/test/

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:

http://home.us.archive.org/~testflip/bookreader/BookReaderIA/test/?Permalinks

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 home.us ~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.us.archive.org
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/arsync.py -l --force
Linking files in ~/bookreader/BookReader to ~/petabox/www/sf/bookreader
    book_bottom_icon.png
    book_down_icon.png

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

http://www-testflip.archive.org

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