Member-only story

How to write your first test in Cypress

Kevin Owasu Itoe
3 min readFeb 20, 2022

We will use the Mocha framework to write our first test in cypress.

Mocha Framework

The Mocha framework is a JavaScript Test framework.

Head over to the Cypress documentation site and copy the Mocha framework structure code.

Structure of the Mocha Framework

There are two important keywords used in the Mocha framework; ‘describe’ and ‘it’.

  • The describe’ function holds a suite of automated tests.
  • The ‘it’ function holds the individual test cases.

In the example above my test suite (describe function) is named ‘My First Test’ and the single test case (it function) is called ‘Does not do much!’.

The ‘describe’ function can hold multiple test cases as per the example screenshot below of two empty test cases (no code).

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Kevin Owasu Itoe
Kevin Owasu Itoe

Written by Kevin Owasu Itoe

Facilitator of self improvement, lifelong learning, family financial education and emotional literacy.

No responses yet

Write a response