Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Sample code for my VT Code Camp 2012 presentation on headless JavaScript unit testing with Jasmine BDD and PhantomJS.

branch: master
README.md

Like a Genie from the Lamp:

Headless JavaScript Testing with Jasmine and PhantomJS

Example code to accompany my presentation on using Jasmine and PhantomJS for lightning-fast JavaScript unit tests, a talk that was given at the 2012 VT Code Camp.

Abstract:

Jasmine is a mature BDD test framework for JavaScript, and though powerful and feature-rich in its own right, you are often still shackled to a browser window to conduct your tests. Tools like Selenium WebDriver make automated testing possible, but they are difficult to set up, cumbersome to use, and worst of all slow. Wouldn't it be nice if you could execute your tests as part of your build? And have those tests before completed in seconds? With PhantomJS ("the headless WebKit") that wish has come true. In this talk we will introduce the Jasmine BDD test framework, introduce PhantomJS, and demonstrate how to execute your Jasmine tests in PhantomJS for lightning fast results.

Running the Code

  • Download/install PhantomJS; make sure it's on your PATH.
  • Checkout this repository; cd into the repo and run these commands:
    • git submodule init
    • git submodule update
  • From within the repo:
    • phantomjs lib/jasmine-reporters/test/phantomjs-testrunner.js $(pwd)/test/all-tests-spec.htm

Resources

Something went wrong with that request. Please try again.