...

/

What Makes Cypress Different?

What Makes Cypress Different?

Learn how Cypress differs from other testing tools in five major points, as well as how it differs from Selenium.

We have already seen what Cypress is, why you should use it, and where it is heading. But how does it differ from existing testing tools? In this lesson, we will go over what makes Cypress stand out from the crowd.


Cypress’s tools

First and foremost, Cypress is an all-in-one tool. We don’t need to install any tools or libraries to get our test suite up and running, Cypress provides all of this in one go. Let’s see what is included in Cypress.

Mocha

Mocha is a JavaScript testing framework with a Behavior-driven Development (BDD) syntax. Cypress heavily relies on the syntax of Mocha, namely when we outline our different test cases:

describe('Describe your E2E test', () => {
    beforeEach(() => {
        // Code that should run before each test
        // This will log a message to the command log.
        cy.log('Running before test case.');
    });
    
    afterEach(() => {
        // Code that should run after each test
        cy.log('Running after test case.');
    });

    it('Should explain the first test case', () => {
        // Your test case
        cy.log('First test case.');
    });

    it('Should explain the second test case', () => {
        // Your test case
        cy.log('Second test case.');
    });
});
"describe" is a top-most block that describes the test file. You can create individual test blocks inside it using the "it" function

Mocha also supports async functions. These ...