在Uber推动端到端测试向左转移
A few years ago, Uber primarily relied on incremental rollout and production probing/alerts to catch regressions. While this approach is sound, it became very operationally expensive and we also experienced many leakages. Detecting issues late requires developers to bisect the exact bad change and then go back through the whole process again.
几年前,Uber 主要依靠增量发布和生产探测/警报来捕获回归问题。虽然这种方法是可行的,但它变得非常操作上昂贵,而且我们也经历了许多泄漏。晚期检测问题需要开发人员对确切的错误更改进行二分,并再次经历整个过程。
Figure 1: Catching issues as early as possible (i.e. shifting detection left) reduces the above operational burden.
图1:尽早发现问题(即向左移动检测)可以减轻上述操作负担。
Many of our outage postmortems indicated little to no testing beyond a few basic unit tests, which were often so dependent on mocks that it was difficult to understand how much protection they actually offered.
我们的许多故障事后分析表明,除了一些基本的单元测试外,很少进行测试,而这些测试往往如此依赖于模拟对象,以至于很难理解它们到底提供了多少保护。
Uber is well-known for having fully embraced microservice-based architecture. Our core business logic is encapsulated across large groups of microservices such that it is difficult to validate functionality within a single service without over-mocking. Because of our architecture, the only sane way to test has been to perform E2E testing. At the same time, our internal NPS surveys consistently highlighted that E2E testing was the hardest part of the job for developers – it’s no surprise it was often skipped.
Uber以完全采用基于微服务的架构而闻名。我们的核心业务逻辑被封装在大量的微服务组中,以至于在不过度模拟的情况下很难验证单个服务的功能。由于我们的架构,唯一明智的测试方式就是进行E2E测试。与此同时,我们内部的NPS调查一直强调E2E测试是开发人员工作中最困难的部分 - 这并不令人意外,它经常被跳过。
A well-known testing blog from 2015, Just Say No To More End-To-End Tests, calls out E2E tests as difficult to maintain, expensive to write, flaky, slow, and difficult to debug. Uber’s journey into testing has run into all of the above problems and we’ve had to come up with creative ways to solve them.
2015年一篇著名的测试博客文章Just Say No To More End-To-End Tests将端到端测试称为难以维护、编写成本高、不稳定、速度慢和难以调试的测试方法。Uber在测试方面的旅程遇到了所有这些问题,我们不得不想出创造性的方法来解决它们。
In this blog, we describe how we built a system that gates every co...