JavaScript Test Driven Development

JavaScript Test Driven Development


This course is for anyone who wants to apply Test Driven Development techniques to JavaScript code.


You should have good working knowledge of JavaScript.


3 days. Hands on.

Course Objectives

The days of writing spaghetti JavaScript should be behind us. JavaScript is a grown-up language now and lies at the heart of mobile-friendly HTML5-enabled Web applications. This course describes how you can apply Test Driven Development techniques to create robust, reliable, and performant web UIs using contemporary JavaScript tools and libraries.

What you'll learn:

  • TDD techniques and principles
  • Contemporary testing frameworks (e.g. Jasmine, QUnit)
  • Test doubles and mocking
  • Testing Ajax
  • Testing Node.js

Course Content

JavaScript essential techniques
Inheritance and prototypes

Test-Driven Development principles
Test, code, refactor, repeat
The benefits of TDD
The process of TDD

Unit testing in JavaScript
Getting started with unit testing
Structure of a unit test
Setting up a test environment
Executing a test

Dealing with browser inconsistencies
Anticipating browser differences
Detecting browser support
Object and feature checking
The role of Modernizr

Testing DOM manipulation
What can you test with DOM?
Testing UI components
Testing events and user interactions

Test doubles and mocking frameworks
Managing dependencies
Defining test doubles
Stubs, mocks, dummies, and fakes
Tool support

Testing Ajax-enabled web pages
Using Ajax manually
Using Ajax via jQuery
Testing GET and POST requests
Testing headers

Testing Node.js at the server
Setting up Node.js
The role of unit testing with Node.js
Techniques for testing Node.js

Virtual Courses

ALL of our courses can be delivered virtually. And our Bath public schedule of courses are now available as live virtual sessions, using the popular Zoom Virtual Classroom and remote labs. Delegates can test their access at:

On-Site Courses

Can't attend one of our public classes? Booking for multiple people?

All our courses are available on your site! Delivered for your staff, at your premises.

Contact us to find out more...