Back to Resources

Blog

Posted June 28, 2023

Accelerate Mobile Test Automation with Sharding for XCUITest and Espresso on Sauce Labs

XCUITest and Espresso are great mobile test automation frameworks that teams can use to run parallel tests. Learn how sharding with each framework can help you accelerate mobile app testing with Sauce Labs.

In the fast-paced world of mobile app development, automated testing plays a vital role in helping teams ship reliable and quality products at speed. Because teams need to get code out the door more quickly than ever, many developers and testers use parallel testing to save time by running the same tests simultaneously. Sharding gives teams an easy way to run parallel mobile tests across real and virtual devices.

In this blog post, we cover what sharding is, how teams can benefit from it across the Software Development Life Cycle (SDLC), and how to use it for mobile app testing on Sauce Labs. 

What is Sharding?

Sharding is a technique used in mobile test automation to distribute test cases across multiple real and virtual devices through parallel testing. It involves dividing test suites into smaller subsets called shards and running each shard concurrently on separate test execution environments. Leveraging sharding helps teams drastically reduce test execution time and enhance overall testing efficiency.

Two widely used testing frameworks by developers, Espresso and XCUITest, play a significant role in testing Android and iOS applications, respectively.

Sharding with Espresso on Sauce Labs

Android Espresso provides sharding capabilities out of the box, which means that your developers can easily configure and execute tests in parallel across multiple devices or emulators without the need for custom implementations. Taking advantage of sharding for Espresso on Sauce Labs can help simplify overall test execution and boost productivity for your team.

Sharding with XCUITest on Sauce Labs

By default, XCODE does not offer sharding capabilities for XCUITest. However, we at Sauce Labs recognize the importance of parallel test execution, which is why we implemented a custom solution through saucectl. You can now use sharding for XCUITest on Sauce Labs to divide test cases and run them simultaneously across multiple real and virtual devices.

The Benefits of Sharding for the SDLC

By using sharding to run parallel tests with XCUITest and Espresso on Sauce Labs, your team can drastically reduce overall test execution time, enable faster feedback loops, and accelerate release cycles. In addition to increasing testing efficiency across the SDLC, this feature also helps identify and resolve issues more quickly, enabling your developers to iterate and refine code more rapidly. 

There are three primary benefits your team can realize by harnessing the power of sharding in your testing strategy:

Reduced test execution time

Sharding enables concurrent execution of test cases, resulting in a substantial reduction in overall test execution time. It automatically divides your test suite into smaller shards for you so you don’t have to waste time with manual setup and maintenance. All of this helps you leverage the power of parallelism so you can significantly improve the testing process and go to market faster.

Improved efficiency and resource utilization

Sharding optimizes the utilization of available test execution environments on the devices that it’s supported by. By running multiple shards concurrently, your organization can make the most of its test infrastructure, increasing the efficiency and productivity of your testing team.

Enhanced test coverage

Sharding not only accelerates the test execution but also enables larger test suites to be executed within a reasonable time frame. This leads to improved test coverage, as more comprehensive testing scenarios can be incorporated into the overall test suite. With increased coverage, your company can have greater confidence in the stability and quality of its applications.

Get Started with Sharding on Sauce Labs

Sharding plays a pivotal role in mobile test automation, allowing your organization to optimize its testing process. By leveraging sharding for XCUITest and Espresso, your team will be able to reduce test execution time, improve efficiency, and enhance test coverage.

Read our documentation to learn get started with sharding on Sauce Labs today!

Need to test right now? Get started free.

Ship code that behaves exactly as it should, faster.

© 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.