Back to Resources

Blog

Posted May 20, 2022

How to Test with Cypress on Sauce Labs

Software developers and testers have more choices than ever when it comes to the test automation frameworks they can use. Since the creation of Selenium, automated frameworks have proliferated the marketplace, offering software development organizations a range of features and capabilities. With testing tools and knowledge shifting left to earlier phases in the software development lifecycle (SDLC), teams may find that developers prefer to use specific test automation frameworks. This means that software organizations may need to accommodate several different automation frameworks in their CI/CD pipeline.

quote

When different test automation frameworks are used within the same organization, compatibility issues can create costly roadblocks and process gaps that may result in a lack of observability for the entire organization. For example, flaky tests and a lack of integration capabilities with other tools can make it difficult to troubleshoot issues in a timely and effective manner.

Sauce Labs offers functionality that can help mitigate the risk of compatibility issues and ensure your tests run quickly and smoothly, regardless of which test automation tools your team uses. Below are some best practices for using Cypress on Sauce Labs.

How to Use Cypress on Sauce Labs

Cypress is an end-to-end JavaScript testing framework that you can use to test your web apps — either locally in Docker or remotely on Sauce Labs cloud — using the saucectl command line interface (CLI). This gives you the flexibility to run your tests in the environment that best suits your organization, while still benefiting from the Sauce Labs vast collection of device, browser, and operating system combinations and test result data analytics.

The saucectl CLI helps to mitigate some of the issues that can occur when software teams use multiple test frameworks. saucectl orchestrates the relationship between your Cypress tests and the rich parallelization, test history filtering, and analytics of the Sauce Labs Continuous Testing Cloud. saucectl performs the underlying business logic to access the tests in Cypress, runs them (either in the Sauce Labs Cloud or locally in a Docker image), then securely transmits the test assets to the Sauce Labs platform, where you can review, share, and evaluate your test outcomes at scale. Learn more about how to configure saucectl to run Cypress tests.

saucectl helps software teams incorporate their Cypress tests earlier in the SDLC to speed up delivery and increase product quality. By covering Cypress in this way, Sauce Labs makes automated testing more accessible and easier for different teams to deliver releases with more confidence in less time. Watch our Cypress on Sauce Labs setup video to get started.

Best Practices for Configuring Cypress Tests on Sauce Labs

While most Sauce Labs features can be accessed easily by entering your own code, it can help to make sure you’re using everything efficiently. Here are some key features to know when configuring your Cypress tests on Sauce Labs

  1. Concurrency: Sauce Labs supports testing in concurrency, which helps increase scalability, collaboration, and consolidation of your tests.

  2. Sauce Ignore: This function allows you to specify certain test files to exclude from your Cypress tests. For example, you can exclude large and/or unnecessary files to increase the speed and efficiency of your test runs. 

  3. Test Sharding: Sauce Labs includes an automatic test sharding feature for Cypress tests to increase the speed of your testing process. When sharding is configured, saucectl automatically splits the tests (e.g., by spec or concurrency) so that they can easily run in parallel. For sharding by concurrency, saucectl splits test files into several groups (the number of groups is determined by the concurrency setting). Each group will then run as an individual job.

For more information, check out our video on how to run tests with Cypress and saucectl.

Achieve Quality at Speed with Cypress on Sauce Labs

Cypress on Sauce Labs gives software development teams easy access to quality feedback at scale while increasing the speed and reliability of your tests.

Ready to get started? Sign up for a Sauce Labs free trial and start testing in minutes.

Published:
May 20, 2022
Share this post
Copy Share Link
© 2023 Sauce Labs Inc., all rights reserved. SAUCE and SAUCE LABS are registered trademarks owned by Sauce Labs Inc. in the United States, EU, and may be registered in other jurisdictions.