Cypress vs Selenium Expert Discussion

Why Cypress is Replacing Selenium as the Go-To Automation Platform

At Keeper Solutions, we love discussing the different tools, technologies and techniques involved in the software development process; their merits, their pitfalls, the truths and myths. Recently we caught up with two of our most experienced QA engineers, Frane Rogosic and Ivan Tadin, to discuss automation frameworks and, specifically, the cypress vs selenium debate. 

But before we get into the topic at hand, let’s first recap on some of the concepts being discussed. 

Cypress vs Selenium – What’s it All About?

To quote a guitar-holding Julie Andrews as she serenades the Von Trapp family members “let’s start at the very beginning, a very good place to start.” For us, that starting point is introducing the concept of test automation. 

When it comes to software development, there are two types of testing – manual and automated. Manual testing is the process of manually testing software for bugs, defects and other issues. It requires a tester to play the role of an end-user. During the manual testing process the tester uses most of the application’s features to ensure correct behaviour. To guarantee completeness of testing, the tester often follows a written plan that leads them through a set of important test cases. It can often be incredibly time-consuming, tedious, and is susceptible to human error. 

Test automation is the practice of automatically reviewing and validating a software product, to make sure it meets predefined quality standards and is functioning as expected. Automation testing is carried out by writing test scripts or using an automation testing tool. Test automation is used to automate repetitive tasks and frees up time to work on higher value tasks. As Keeper QA Engineer Ivan says “automation is simply used to speed up regression testing and to make sure that everything that was tested before, still works”. 

Test automation is carried out using ‘test automation frameworks’ which are a set of components that facilitate the execution of tests and reporting of test results. A big decision that comes in any software development project, is a choice between the two most popular test automation frameworks – Cypress vs Selenium

Introducing the Two Most Popular Automation Frameworks

First established in 2004, Selenium is an open-source tool that allows users to test web applications across different browsers and platforms. It provides a single interface that lets you write test scripts in programming languages like Ruby, Java, NodeJS, PHP, Perl, Python, and C#, among others. Of the many automation testing tools available, Selenium is one of the most widely used to test web applications. It’s known for allowing testers to automate in any preferred programming language. However, the downside of this is that not all testers know how to programme. This makes it a difficult tool for those new to coding. 

Cypress, on the other hand, is a purely JavaScript-based front-end testing tool built for the modern web. It’s an end-to-end framework that aims to unify web app testing regardless of the programming language used. It works on all platforms and all browsers and has taken the world of functional test automation by storm since its introduction in 2014. As opposed to Selenium, which allows testers to automate testing from scratch, Cypress bundles together many capabilities and serves as an all-in-one solution. 

Why Cypress is Replacing Selenium as the Go-To Platform

When we started our discussion, the question of “why Cypress is replacing Selenium as the go-to platform for test automation” was immediately thrown into disarray. 

Ivan: Cypress is not replacing Selenium. There is still a massive Selenium community. It’s a matter of preference. A lot of people might have started out on Selenium and moved to Cypress but that does not mean one is replacing the other.

Frane: Cypress is a tool built by QAs for QAs. That’s important to keep in mind. The people behind Cypress built a whole new tool from scratch but carried over some best practices that people who worked with Selenium used. They solved some issues that you had to handle yourself in Selenium out-of-the-box so it’s a much simpler solution. 

Ivan: Selenium is the W3C standard which is the main international standard for the web.

Frane: I knew you’d bring that up!

Ivan: That’s just a fact.

Frane: Besides that there are lots of advantages of using Selenium. It has been around for over twenty years so there is a much bigger community. There are more resources, training tips and books written on it.  

Ivan and Frane brought us through their own personal histories with the two test automation frameworks. 

Frane: You can think of Selenium vs Cypress as being the traditional tool vs the modern tool. I started out using Selenium but switched to Cypress because Selenium couldn’t handle some modern technologies. When we were using modern front-end frameworks like Vue.js or Angular, Selenium had some weird failures. It took some working around to get modern technologies implemented. I started using Cypress about four years ago. It’s come to a stage where my tech stack is now Cypress and I’m no longer interested in working on projects that use Selenium. 

Ivan: Selenium was the first automation tool. A lot of tools have been introduced since then, one of which happens to be Cypress. With Selenium you have to build everything from scratch. There is nothing behind the scenes. You have to write all the code. But Cypress is much easier to set up. This makes it much easier to get new QAs up and running. There is less of a learning curve and less of a need for coding as the standard automation code has been resolved behind the scenes. Once the framework is set up, you can teach any QA how to run their own tests in a very short space of time. 

Originally I was a Selenium aficionado. The reason I liked it was because I liked working from scratch. I liked solving problems myself. When something went wrong I liked to go deep into the code and figure out the issue on my own. With Cypress, it’s more of an out-of-the-box solution. The downside of this is that it’s a bit more difficult to figure out issues yourself. You can’t dig deeper in the same way that you can when working on your own code. But, that said, I changed to Cypress because it’s a lot easier to set up. It’s a lot easier to maintain…

Frane: it’s faster!

Ivan: It’s not faster. If you can write good code it’s not faster! 

Ivan (continued): It’s also better equipped to handle modern technologies because it  works together with today’s major front-end frameworks i.e.with React, Vue.js and Angular. But the main advantage is that you can get young automation engineers up and running in no time at all. I haven’t used Selenium in over five years now. I’m really liking Cypress now. It’s versatile enough to accomplish what I need. I’m probably at a stage now where I’d recommend it as the main automation tool.

Why Keeper Solutions Uses Cypress 

Ivan and Frane have both been using Cypress for several years and their teammates at Keeper Solutions have been doing likewise. Although neither Frane or Ivan necessarily agreed that Cypress was “replacing” Selenium, they both recommended it as the leading test automation framework for modern businesses that are trying to scale. To close out our conversation, we dug into this recommendation a little deeper.

Ivan: Cypress is the ‘new kid on the block’. It’s modern and fast to set up. A major Cypress (v10) upgrade has been released this year and it works beautifully. The community is growing steadily so there will be more and more resources available. You can onboard inexperienced QAs to start using it without having to spend hours on training. You can set up a framework for almost anybody to run a test. But at the same time it’s strong enough to do whatever you want on it be it API testing, database testing or UI testing. It’s very versatile.

Frane: The fact that it’s so easy to onboard people is a huge factor. If you are growing your company and recruiting more automation engineers, it’s much easier and faster to get them up-to-speed on a Cypress project, regardless of experience level. This makes Cypress the perfect solution for scaling companies. We use it at Keeper because we want to pass on these advantages to our clients.

Thanks very much to both Frane Rogosic and Ivan Tadin for taking the time to speak with us and providing us with all the introductory information on both platforms. If you have any questions about Cypress or Selenium, please feel free to reach out.