Unit Testing and Test Driven Development in NodeJS
Created by Richard Wells, Last Updated 11-Jul-2020, Language:English
Unit Testing and Test Driven Development in NodeJS
Learning the discipline of Test Driven Development (also known as TDD) in NodeJS with Javascript.
Created by Richard Wells, Last Updated 11-Jul-2020, Language:English
What Will I Get ?
- Learn what is Unit Testing and Test Driven Development and how does it help you.
- What are the Mocha and Chai testing libraries and how are they used for writing unit tests in NodeJS.
- How to setup some common NodeJS development environments to use Mocha and Chai.
- What are Test Doubles and how do you implement and use them with Sinon.
- What are some Best Practices for unit testing and Test Driven Development.
- We’ll also walk through some hands on example programming sessions using TDD in NodeJS.
Requirements
- Introductory understanding of Javascript and NodeJS
- A PC running Windows, MacOS X, or Linux
- NodeJS installed on the PC
- Your preferred IDE or code editor installed
Description
Test Driven Development is a key discipline every software developer should practice to ensure the quality of their code. In this course I'll show you how to use this discipline in your everyday coding practices to help ensure the quality of your code base.
In this course we’ll be going over:
- What is Unit Testing and Test Driven Development and how does it help you.
- What are the Mocha and Chai testing libraries and how are they used for writing unit tests in NodeJS.
- How to setup some common NodeJS development environments to use Mocha and Chai.
- What are Test Doubles and how do you implement and use them with Sinon.
- What are some Best Practices for unit testing and Test Driven Development.
- We’ll also walk through some hands on example programming sessions using TDD in NodeJS.
Course Content
-
Introduction
1 Lectures 00:02:22-
Introduction
Preview00:02:22
-
-
Overview and Setting Up Your Development Environment
9 Lectures 00:29:09-
What is Unit Testing?
Preview00:03:35 -
What is Test Driven Development?
Preview00:04:37 -
Quick Example TDD Session - The FizzBuzz Kata
00:11:35 -
Installing Mocha and Chai
00:03:03 -
Setting Up Mocha Test Runners in Webstorm
00:03:53 -
Setting Up Mocha Test Runners in Visual Studio Code
00:02:26 -
Assignment - Setup your development environment and do the FizzBuzz Kata
-
Quiz - Unit Testing and Test Driven Development Quiz
-
Quiz Answers
-
-
Exploring Mocha and Chai with Examples
6 Lectures 00:25:35-
Mocha and Chai Introduction and Overview
00:01:57 -
Test Discovery
00:03:27 -
Test Suites
00:03:37 -
Test Setup and Teardown
00:06:26 -
Assert Statements with the Chai Assert Library
00:04:43 -
Testing Asynchronous Code
00:05:25
-
-
Hands-On Example - Implementing a Checkout Cart with TDD
7 Lectures 00:23:14-
Overview
00:01:33 -
Setup and First Test Case
00:02:01 -
Add Items, Add Item Prices, and Calculate Total
00:04:38 -
Add Multiple Items and Calculate Total
00:02:20 -
Add and Apply Discounts
00:10:54 -
Throw Exception when Adding an Item with No Price
00:01:48 -
Assignment - Implement the Super Market Checkout Kata While Following Along with the Lecture
-
-
Isolating Your Unit Tests
5 Lectures 00:15:06-
Overview of Test Doubles with Mocha
00:06:51 -
Sinon Example
00:08:15 -
Assignment - Update the Checkout class to read item prices from a file
-
Quiz - Test Doubles Quiz
-
Quiz Answers
-
-
Best Practices for Unit Testing and TDD
3 Lectures 00:07:14-
Unit Testing and TDD Best Practices
00:03:16 -
Overview of Code Coverage
00:02:18 -
Hands On Example of Code Coverage
00:01:40
-
-
Conclusion
1 Lectures 00:02:23-
Conclusion
00:02:23
-