Skip to Content
Learn
Automate and Organize Tests
Introduction

Testing is an essential part of development. When used properly, testing can catch and identify issues with your implementation code before you deploy it to users. Instead of testing every function manually, developers automate their tests with a test framework.

Developers use test frameworks to organize and automate tests that provide useful feedback when errors occur. In this lesson we will use the Mocha test framework to write tests against JavaScript methods.

In this lesson you will:

  • Learn to write a basic Mocha test suite
  • Use Node’s assert.ok method to verify the expected output of your code
  • Understand and apply the four phases of a test to create an expressive testing suite
  • Evaluate the quality of your tests against the characteristics of a good test

Instructions

1.

A complete test suite is provided for you on the right. Run the suite and view its output by typing npm test in the terminal and hitting Enter.

Can you match the test output in your terminal to strings in index_test.js?

Folder Icon

Sign up to start coding

Already have an account?