减少 CI 等待时间:Pinterest 如何将 Android 测试构建时间缩短 36%+

[

[

](https://medium.com/@Pinterest_Engineering?source=post_page---byline--feb6ff121d91---------------------------------------)

](https://medium.com/@Pinterest_Engineering?source=post_page---byline--feb6ff121d91---------------------------------------)

George Kandalaft | Software Engineer II, Test Tools; Alice Yang | Staff Software Engineer, Test Tools

George Kandalaft | 软件工程师 II,测试工具;Alice Yang | 员工软件工程师,测试工具

Press enter or click to view image in full size

按回车键或单击以查看完整图像

TL;DR

简而言之

Problem Statement

问题陈述

Our Android end-to-end testing builds in CI were slow and flaky because the test shards were unbalanced and the entire build had to wait for the single slowest shard on a third-party testing platform.

我们的 Android 端到端测试在 CI 中构建缓慢且不稳定,因为测试分片不平衡,整个构建必须等待第三方测试平台上单个最慢的分片。

Solution

解决方案

We built a runtime-aware sharding mechanism that uses historical test duration and stability data to pack tests greedily in an in-house testing platform with EC2-hosted emulators, ensuring all shards have a similar total runtime.

我们构建了一种运行时感知的分片机制,利用历史测试持续时间和稳定性数据,在内部测试平台上贪婪地打包测试,使用EC2托管的模拟器,确保所有分片具有相似的总运行时间。

Impact

影响

The end-to-end build time was reduced by 9 minutes (a 36% improvement), decreased the slowest shard’s runtime by 55%, and compressed the time difference between the fastest and slowest shards from 597 seconds to just 130 seconds.

端到端构建时间减少了9分钟(提高了36%),最慢分片的运行时间减少了55%,并将最快和最慢分片之间的时间差从597秒压缩到仅130秒。

Introduction

介绍

At Pinterest, one of the Test Tools team missions is to save engineers time across development, testing, and shipping. Delivering on that mission requires fast, reliable feedback for our end-to-end (E2E) testing pipelines. As our app and test suites have grown, we faced a familiar challenge: how do we keep E2E tests fast and reliable as test volume and complexity rise in CI?

在Pinterest,测试工具团队的使命之一是节省工程师在开发、测试和交付过程中的时间。实现这一使命需要为我们的端到端(E2E)测试管道提供快速、可靠的反馈。随着我们的应用程序和测试套件的增长,我们面临着一个熟悉的挑战:在CI中,随着测试量和复杂性的增加,我们如何保持E2E测试的快速和可靠?

Our Android E2E tests run on emulators and devices that exercise real user flows. In CI, we traditionally...

开通本站会员,查看完整译文。

Home - Wiki
Copyright © 2011-2025 iteam. Current version is 2.148.0. UTC+08:00, 2025-11-12 02:39
浙ICP备14020137号-1 $Map of visitor$