Book Image

Using Node.js for UI Testing

By : Pedro Teixeira
Book Image

Using Node.js for UI Testing

By: Pedro Teixeira

Overview of this book

<p>Automating tests for your user interfaces has always been the holy grail of programming. Now, using Zombie.js and Mocha you can create and quickly run your tests, allowing you to test even small changes. Increase your confidence in the code and minimize the number of times you have to use a real browser while you develop.</p> <p>"Using Node.js for UI Testing" is a quick and thorough guide on how to automatically test your web app, keeping it rock solid and bug-free. You will learn how to simulate complex user behaviour and verify that your application behaves correctly.</p> <p>You will create a web app in Node.js that uses complex user interactions and AJAX; by the end you will be able to fully test it from the command-line. Then you will start creating the user interface tests for this application using Mocha as a framework and Zombie.js as a headless browser.</p> <p>You will also create a complete test suite, module by module, testing simple and complex user interactions.</p>
Table of Contents (15 chapters)

Chapter 1. Getting Started with Zombie.js

"Zombie.js is a lightweight framework for testing client-side JavaScript code in a simulated environment. No browser required."

This definition is from the Zombie.js documentation at http://zombie.labnotes.org

Automating tests for your web application is crucial to having a quality product, but doing it properly can be a painful experience. That is why most of the time this part of the project never gets implemented. Developers either limit themselves to testing the underlying business logic and control flow in isolation, or, if they really want to test the user interface, must resort to complicated setups where you somehow connect to real browsers and command them using remote scripts.

Zombie.js provides a fast and easy alternative to this scenario, enabling you to easily and quickly create automated tests for your web application just by using JavaScript.

The topics covered in this chapter are:

  • A brief history of software testing

  • Understanding the server-side DOM

  • How Zombie.js works internally

By the end of this chapter, you should understand how Zombie.js works and what types of applications can be tested using it.