Blog

Automation Using Cypress End to End Testing Tool

ByAdarsh
February 6th . 5 min read
Automation Using Cypress End to End Testing Tool

The more technology is growing and getting advanced, the more likely people are tilting towards automation. They want everything automated. They expect to achieve fast and efficient results without putting much effort. In short, with low input, they want high output, which is completely fair and possible with the help of latest tools and technology.

The same is true with automation testing. Automation in regression testing spares a great deal of time and manual effort. There are so many tools available for automation testing and in this article, I’m going to describe one of them i.e. Cypress, along with its installation process briefly.

About Cypress

Cypress is an automation tool for End to End testing. While it seems to be a very good competitor of Selenium, it is quite different both fundamentally and architecturally, at the same time. Firstly, it is not constrained by the same restrictions as Selenium. Also, it uses NPM Packages of Node JS. It’s like setting up a node project. Another, it enables you to write faster, easier and more reliable tests.

You can write the following tests in Cypress:

  • End-to-end tests
  • Integration tests
  • Unit tests

Cypress can test anything that runs in a browser. It has its own test runner. A test runner uses two browsers for test, i.e.

  • Chrome
  • Electron (Headless Browser)

Cypress tests can also be recorded in the Cypress dashboard online. Cypress Dashboard is also useful for reporting. If you compare it with selenium then you would know that selenium doesn’t provide you the tools like Dashboard and Test Runner.

Installation Process:

  • First, install the latest version of Node.js.
  • Then create a folder in which the project will be installed. For example, the folder name is “Project”
  • Open that folder & type CMD in its location.
  • It will open Command Prompt in that folder.

Now, type the command-

 npm install cypress --save-dev 

This command will install cypress as a dev dependency.

automation-using-cypress-end-to-end-testing-tool-1.jpg

Downloading, Unzipping & Installation will be started after executing the above command. See the below image>>

automation-using-cypress-end-to-end-testing-tool-2.jpg

automation-using-cypress-end-to-end-testing-tool-3.jpg

Cypress has successfully been installed. See the above image, you’ll see that package.json is missing. If you want to create package.json, then run the command npm init. This package has all plugins & script information needed to execute a project.

This folder will look like this-

automation-using-cypress-end-to-end-testing-tool-4.jpg

Cypress Test Runner:

To open the cypress test runner, run the command-

 node_modules\.bin\cypress open 

It shows the already created scripts. If you create your own then it will appear here. See the below image of test Runner-

automation-using-cypress-end-to-end-testing-tool-5.jpg

Script Execution:

Click on any script then it will be opened in the chrome browser. It looks in chrome like below image>>

automation-using-cypress-end-to-end-testing-tool-6.jpg

In the Chrome browser, it will show all test suit & test cases on the left-hand side. On the right side, it will show the visual execution of the script in browser. If you want to run the scripts in command line then run the command-

 node_modules\bin\cypress run 

It will run the scripts in headless browser Electron.

Cypress Dashboard:

If you want to use the cypress dashboard then open URL “https://dashboard.cypress.io/login” in the browser. Log in to the dashboard using your GitHub or Google account. After that, you can configure your project in the dashboard. It will show all recording, screenshots, videos & reporting of your Test execution (As shown in the image).

automation-using-cypress-end-to-end-testing-tool-7.jpg

Conclusion:

Those who are new to automation and only know about the basics of coding, its an easy to use tools for them. The testers who are using selenium can also switch this tool. It shows script execution and bugs in browser as well. Even its dashboard provides full reporting of script execution.

Your feedback is most welcomed in the comments section.

You can learn more here about AI & ML Testing - Future of Software Testing?

Thanks for Reading!!

Share:
0
+0