Cypress is a front-end testing tool for use with web-based applications and services. Developers can quickly and easily configure tests to debug code as part of a CI/CD workflow.
The system is extremely powerful and flexible, capable of writing all types of test, including:
- End-to-end tests
- Component tests
- Integration tests
- Unit tests
Perhaps most importantly, Cypress can test any code that runs in a web browser.
The key features of Cypress
Cypress offers functionality that other testing tools cannot, including:
1. Real-Time Reloading
By reloading test scripts in real-time, as they are written, Cypress increases efficiency of the testing workflow. This boosts efficiency, shortens testing cycles and allows the development team to identify and address issues more quickly.
2. Interactive test runner
Debugging and troubleshooting is simplified thanks to the built-in interactive test runner that allows you to see the application state at each step of the test.
3. Automatic Waiting
Many traditional testing tools expect testers to specify explicit waits or timeouts. Cypress automatically waits for elements to become available and actions to complete, reducing the amount of manual input required to execute each test.
4. Time Travel playback
With the ability to playback each test in the Cypress test runner, you can ‘time travel’ through the application’s actions and state changes. The ability to check execution visually makes it easier to pinpoint issues and focus development efforts.
5. Comprehensive DOM snapshots
At every step of every test, Cypress captures a DOM snapshot. Developers can see the application’s state at any point of the test.
6. Cross-Browser Testing
Not all browsers are equal, hence the need to test applications against several. Cypress was originally designed for use with Chromium-based web browsers, but now offers support for running tests in other applications including Edge, Firefox and Chrome.
7. Execute parallel tests
Historically tests needed to be run one after the other, increasing the time taken to complete a testing cycle. Cypress offers parallel test execution, allowing you to run tests concurrently, and significantly reducing time and resources spent on testing code updates.
What is Cypress used for?
Cypress is used to simplify and accelerate the testing phase of web application development. According to Cypress, the tool has been optimised to:
- Set up tests
- Write tests
- Run tests
- Debug Tests
Requiring minimal setup and configuration, it is possible to write a passing software test in just 60 seconds.
How is Cypress different from other web application testing tools?
Cypress is often compared to Selenium, another well-known testing tool. However, there are some key differences that make Cypress a better choice:
- Unlike other testing tools which run outside the browser, Cypress is executed in the same loop as the application.
- Running on a Node server process, Cypress can access both front and back-end events in real time.
- Cypress delivers more consistent test results than other tools because it controls the entire automation process.
- As a locally installed application, Cypress can make use of machine-level features like taking screenshots, video recording and file and network-level operations – functionality that is unavailable in other apps.
Who uses Cypress?
Cypress is downloaded more than 5 million times every week. The tool has several high-profile users including:
Cypress has more than 753K dependent GitHub repositories and 43K+ GitHub star ratings. Any organisation writing applications for the web will benefit from using Cypress to simplify and accelerate their software testing processes.
Is the Cypress framework free?
Cypress has two parts:
1. The locally installed Cypress application
2. The Cypress Cloud service
The Cypress application is open source, available under the MIT licence. It is also completely free to download and use. This means that you can write and execute in-browser tests completely free of charge.
Cypress Cloud is a paid-for add-on used to record test runs for analysis later, usually after Cypress has been integrated with your Continuous Integration pipeline. Like most hosted offerings, Cypress Cloud is billed on a pay-as-you-use model to control costs and contain capital spend.
Is Cypress difficult to learn?
Is there anything else I need to know about Cypress?
This article and infographic are part of a larger series centred around the technologies and themes found within the 2023 edition of the TechRadar by Devoteam report. To learn more about Cypress and other technologies your business should seriously consider adopting, please download the 2023 TechRadar by Devoteam report.