Book Image

CoffeeScript Application Development Cookbook

By : Mike Hatfield
Book Image

CoffeeScript Application Development Cookbook

By: Mike Hatfield

Overview of this book

Table of Contents (18 chapters)
CoffeeScript Application Development Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

End-to-end testing with Mocha and Zombie.js


Mocha is a testing framework similar to QUnit but more suited for console-based testing, as opposed to browser-based testing. It has familiar describe() and it() blocks.

Zombie.js is a headless testing tool that allows us to test our application end-to-end. Using Zombie, we can open our application within a simulated browser environment and interact with the server layer of our application to verify both the backend and frontend functions as expected.

In this recipe, we will use Mocha and Zombie together as an effective tool to test our application end-to-end.

Getting ready

In our example, we will create a test that will launch our simple Calculator app and verify that it can add two numbers. We will have a simple HTML form with two input boxes, a button to trigger the calculation, and then verify the answer that is displayed.

We will need to install Mocha and Zombie. These are both available as NPM packages.

Mocha has a test runner executable, so we...