Skip to main content

Describe and It in Cypress

The test interface of Cypress is borrowed from Mocha. Cypress has adopted Mocha's BDD Syntax which fits perfectly with unit and integration testing.

Cypress provides describe(), context(), it() and specify(); describe() provides a way to keep tests easier to read and organized.

Cypress Describe

describe() is basically to group our test cases. We can nest our tests in groups as deep as we deem necessary. describe() takes two arguments, the first is the name of the test group, and the second is a callback function. There can be multiple describe in same file. Also one describe can be declared inside another describe.

Cypress Context vs Describe

context() is just an alias for describe(), and behaves the same way. Check example below.

Cypress it

it() is used for an individual test case. it() takes two arguments, a string explaining what the test should do, and a callback function which contains our actual test:

Cypress It vs Specify

specify() is an alias for it(), so choose whatever terminology works best for you. Check below example.

Example Cypress Describe and It

describe('First Describe', () => {
  describe('Describe Inside Describe', () => {
    it('first test inside', () => {
  it('1st test', () => {

  specify('2nd test', () => {
  it('3rd test', () => {
context('2nd suite', () => {
  it('first test', () => {

  it('2nd test', () => {
  it('3rd test', () => {

with () => we are declaring call back function, A callback is a function passed as an argument to another function.  

Video Tutorial: Cypress Describe vs It

Submitted by tgoswami on May 5, 2021

Tarun has 11+ years of experience in Quality Assurance in different domains like Banking, E-commerce, Health and Education.


At ProgramsBuzz, you can learn, share and grow with millions of techie around the world from different domain like Data Science, Software Development, QA and Digital Marketing. You can ask doubt and get the answer for your queries from our experts.