Hey, hello, everyone. Welcome to Test Automation University. My name is Giridhar Rajkumar and I will be your instructor for this course.

A testing framework is a set of guidelines for quality engineers defined to create and design effective test cases.

Mocha is one such effective testing framework based on JavaScript. This course is entirely about the basics of Mocha.

By the end of this course, you will be able to write your first test with Mocha.



Firstly, we will start learning what Mocha is and how to set up Mocha in a JavaScript test project using the terminal.

Then, we will see about two pre-bundled function calls: the describe() and it(). The describe function is used to group the tests and the it function is used for writing individual test cases. We will learn these two function calls with examples.

We will also be learning about the hooks in Mocha:

  • before()
  • after()
  • beforeEach()
  • afterEach()

Following that, we will learn about the different test features in detail that are available in Mocha like inclusive, exclusive, and pending.

We will also be seeing about retry and timeout functionalities to rerun failed tests up to a certain number of times.

Last but not least, we will be learning about the different types of reporters generated by Mocha like, spec and dot matrix.

We will be using Visual Studio Code as IDE and Terminal for console programming.

Of course, you can use the IDE of your own choice as well.

Now, let's get started.

Resources