Book Image

Backbone.js Testing

By : Ryan Glenn Roemer
Book Image

Backbone.js Testing

By: Ryan Glenn Roemer

Overview of this book

Table of Contents (13 chapters)
Backbone.js Testing
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Headless testing with PhantomJS


As a concrete automation example, we will adapt our existing Backbone.js test infrastructure to use PhantomJS. PhantomJS offers an amenable set of features and capabilities for Backbone.js testing—it is fast, relatively easy to set up, and provides a real (headless) browser. As a practical matter, larger Backbone.js applications often require a real browser engine to function properly, particularly applications that exercise the murkier and more complicated parts of the browser environment.

Installing PhantomJS and the supporting tools

To get up and running with PhantomJS, let's start by installing the toolkit as per the instructions at http://phantomjs.org/download.html. Note that the installation procedures are operating system dependent, with packages for Windows, Mac OS X, and Linux. Alternatively, PhantomJS can be installed directly with NPM using the phantomjs Node.js wrapper (https://github.com/Obvious/phantomjs).

Note

We provide command line examples in...