Uber Automates 75K+ Test Migrations to JUnit 5

Alps Wang

Alps Wang

Apr 28, 2026 · 1 views

Automated Scale: Uber's JUnit Migration Playbook

Uber's successful migration of over 75,000 test classes from JUnit 4 to JUnit 5 is a testament to sophisticated engineering and the power of automated code transformation. The key takeaway is the strategic combination of a compatibility layer with Bazel, the use of OpenRewrite for deterministic code manipulation, and an internal orchestration system (Shepherd) for execution at scale. This approach effectively mitigates the inherent risks and complexities of such a large-scale refactoring. The explicit rejection of generative AI for this task, citing inconsistent results, is a crucial point, underscoring the need for precise, rule-based automation in critical code transformations. This story highlights how even seemingly routine framework upgrades require deep architectural planning and custom tooling when dealing with a monorepo of Uber's magnitude.

While the article focuses on the technical success, a deeper dive into the operational impact and the long-term maintenance of the custom OpenRewrite recipes would be beneficial. The iterative rollout model, while effective, likely involved significant effort in debugging and refining the transformation logic. Furthermore, the article mentions the migration laying the foundation for other large-scale transformations, such as Guava to standard Java APIs. This implies a broader strategy within Uber for tackling technical debt through automation, which is a significant strategic insight. The success here validates the investment in such tooling and processes, making it a compelling case study for other large organizations dealing with legacy codebases and evolving technology stacks. The emphasis on deterministic tooling is paramount; in a system with millions of lines of code and thousands of tests, any non-deterministic approach would be a recipe for disaster. This migration is not just about adopting a new testing framework; it's about building robust, scalable automation capabilities for continuous modernization.

Key Points

  • Uber migrated over 75,000 test classes and 1.25 million lines of code from JUnit 4 to JUnit 5.
  • The migration leveraged automated code transformation using OpenRewrite for deterministic updates.
  • A compatibility layer using the JUnit Platform allowed both JUnit 4 and JUnit 5 tests to run concurrently during the transition.
  • Uber's internal orchestration system, Shepherd, managed execution at scale across thousands of Bazel targets.
  • Generative AI was avoided due to inconsistent results, emphasizing the need for precise, rule-based automation.
  • The project established a foundation for future large-scale code migrations within Uber.

Article Image


📖 Source: Uber Migrates 75,000+ Test Classes from Junit 4 to Junit 5 Using Automated Code Transformation

Related Articles

Comments (0)

No comments yet. Be the first to comment!