JavaScript Test Driven Development

Contact Us for Dates
3 days practical workshop for up to 12 people.

Only £1185 per person

Contact us for Onsite Price

Enterprise JavaScript is now commonplace and the importance of unit testing JavaScript applications is well understood. In this class, you will be introduced to best practices around test driven development with the JavaScript language and the NodeJS framework. Modern test frameworks such as Jest will be explored and used for both testing and mocking.

Layout

This course is a mixture of lectures and hands on exercises designed to reinforce the topics learnt

Training Course Objectives

  • TDD techniques and principles
  • Contemporary testing frameworks (e.g. Jest)
  • Test doubles and mocking
  • Client side testing
  • Server side testing Node.js
  • Mocking in JavaScript

Training Course Prerequisites

  • Good working knowledge of JavaScript

Chapters

Chapter 1 JavaScript essential techniques

  • Closures
  • Inheritance and prototypes
  • Properties
  • Namespaces
  • Encapsulation

Chapter 2 Test-Driven Development principles

  • Test, code, refactor, repeat
  • The benefits of TDD
  • The process of TDD

Chapter 3 Unit testing in JavaScript

  • Getting started with unit testing
  • Structure of a unit test
  • Setting up a test environment
  • Executing a test
  • Refactoring

Chapter 4 Testing DOM manipulation

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

Chapter 5 Test doubles and mocking frameworks

  • Managing dependencies
  • Defining test doubles
  • Stubs, mocks, dummies, and fakes
  • Tool support

Chapter 6 Testing API Calls

  • Using Ajax manually
  • Using Ajax via Frameworks
  • Testing GET and POST requests
  • Stubbing
  • Testing headers

Chapter 7 Testing Node.js at the server

  • Setting up Node.js
  • The role of unit testing with Node.js
  • Techniques for testing Node.js