Testing with robots
Now that we've covered a method of testing the fine detail of our code, let's look at a completely different way of running functional checks across the entire application. For this, we'll need a new tool: CasperJS. It allows you to drive a "headless browser"—one without any user interface—navigate around an application, and run evaluations on what we find. The first step is installation, which varies depending on the platform. Instructions for the same can be found at http://docs.casperjs.org/en/latest/installation.html.
When complete, we'll have a CasperJS command available to run.
With Jasmine, we were using the behavior-driven method of testing with expectations to verify the code. In CasperJS, we go back to using the assertion style of testing. Take a look at a minimal test script from the CasperJS documentation:
casper.test.begin("Hello, Test!", 1, function(test) { test.assert(true); test.done(); });
Pretty...