top of page
  • Writer's pictureNick

Cypress

Selenium, that famous and practical automating tool we love so much, it’s easy to believe that no better option exists. Well, at least that’s what I thought for a long time, always suggesting Selenium when it came to new projects. Undoubtedly, it is an excellent tool for test automation.

However, a few months back, I started hearing the word ‘Cypress’ more and more often in the quality assurance field. Although I already knew of its existence, I didn’t give it much importance until I saw that job interviews and job posts related to automation began requesting Cypress knowledge. After learning a bit more about the tool and working with it for a while, I now know why Cypress is increasingly required.


Cypress is one of the Test Automation tools which has established its place very quickly and easily replace most popular tool uses for Web integration and End to End UI test automation.



What is Cypress?

It is a test automation framework with an architecture that’s different from the others. Its ‘built-in tools’ is an all-in-one framework that includes all the necessary tools to start automating immediately.

It is commonly compared with Selenium. But there are a lot of differences between Cypress and Selenium in terms of architecture and foundation. Cypress is targeted basically for below −

  • Unit Testing

  • Web Integration Testing

  • End to End Testing.

Why Cypress?
  1. Cypress takes snapshots while tests are running. This way, we can easily identify what’s happening with our tests simply by moving the mouse across the command log.

  2. Cypress uses an interactive ‘runner’ to run tests. This allows us to see the commands that are being executed while viewing the application that’s being tested.

  3. Cypress Dashboard gives us access to all tests performed. For example, in our continuous integration (CI) tool, Dashboard provides information about what happened during the tests by taking screenshots and recording videos of failed tests. Additionally, it allows us to organize our Cypress project from a single place, providing integration with other tools such as Github and Slack.

  4. Cypress functionality allows us to run tests in the background, hiding the browser.(Headless).

  5. Cypress doesn’t need to add explicit or implicit wait commands in test scripts, unlike Selenium. Cypress waits automatically for commands and assertions.

  6. Developers or QAs can use Spies, Stubs, and Clocks to verify and control the behavior of server responses, functions, or timers.

  7. Cypress carries excellent documentation. Earlier we can say this thing only for Robot Framework.

  8. Cypress automatic scrolling operation ensures that an element is in view before performing any action (for example Clicking on a link)

  9. Cypress has a proper error logging message which describes the reason for our script failure.

  10. Cypress has a Ability to test edge test cases by mocking the server response.

  11. Cypress Dashboard provides a interactive feature of View videos of the execution of your entire tests.

Advantages Over Other's Tool

The following are some of the main advantages of using Cypress:

  1. It’s easy to install and easy to start automating. Cypress has several built-in tools that allow us to begin automating immediately after installation.

  2. It delivers fast, consistent, and reliable test execution compared to other automation tools because of its architectural design.

  3. It registers all actions for better debugging of test cases.

  4. It takes screenshots and records videos. Dashboard provides lots of advantages for generating concrete and reliable reports of our test cases.

  5. Complete documentation with examples on the official website.

  6. Cypress automatically waits for commands and assertions before moving on. No more async issues.(Using of sleep)


Disadvantages Over Other's Tool

Cypress has a lot of advantages in comparison to other automation tools, but it also has some disadvantages that should be taken into consideration for a clear perspective of the tool. Among these we find:

  1. Cypress only allows interaction with a single tab of the application under testing (AUT) and this will not change. Given its architecture and how Cypress runs on the browser, there are ways to mitigate this situation.

  2. It’s not possible to do a ‘mouseover’ with Cypress. Currently, there’s a pending ticket regarding this matter that will surely be dealt with in future versions.

  3. Cypress is free! But the Dashboard service has certain restrictions. For 5 users or more, the cost is $100 per month, and the fee increases depending on the number of users.

  4. Although usable, the ‘Page Object Model’ pattern is not recommended by Cypress developers. From my perspective, this has to do with the way synchronicity/asynchronicity is used. This is a topic that could be discussed in more depth, but there’s no need for concern! It’s just a matter of having a little knowledge of the programming language and the way synchronicity is handled, then we’ll be able to keep using our favorite automation pattern.

  5. If you’re not familiar with Javascript or any other scripting language, you may feel a little lost in the beginning.

  6. It doesn’t support native mobile apps, but it does intend to support mobileweb browsers in the future.

  7. Cypress does not support for multiple browser tabs or popups. You cannot use Cypress to drive two browsers instances at the same time.










Comments


Watermark Big.png
bottom of page