Skip to content

JUnit 5 migration and parallel Unit Test Execution #2649

@AbgarSim

Description

@AbgarSim

This is a polite proposal for my contribution to this repo. If approved by the team I can take the initiative and do this migration, also the parallel execution described below will greatly speed up build time.

Also I believe this issue #2460 can be addressed while migrating as well

Is your feature request related to a problem? Please describe.

This repository contains a large unit test suite (800+ tests) that currently runs in ~2 minutes. The tests are written in JUnit 4, which limits developers ability to leverage JUnit’s built-in parallel execution features. As the suite keeps growing, keeping CI feedback fast becomes harder.

Describe the solution you’d like

Enable faster test execution by migrating the unit test suite to JUnit 5 (Jupiter) and turning on JUnit 5 parallel test execution. The goal is to reduce CI wall-clock time for the test phase while preserving determinism and keeping flaky tests under control (with the ability to opt specific tests out of parallelism when they touch shared state).

Describe alternatives you’ve considered

Parallelization at the build tool level only (e.g., Maven Surefire forks / Gradle parallel test workers) without migrating to JUnit 5.
Splitting/sharding tests across multiple CI jobs.
Keeping JUnit 4 and introducing a custom parallel runner (adds complexity and tends to be less maintainable than Jupiter’s native model).
Leaving tests sequential and focusing only on test optimization (still doesn’t scale as the suite grows).

Additional context

JUnit 5 provides first-class parallel execution controls via configuration (junit-platform.properties) and per-test opt-outs, which should make it easier to safely introduce concurrency compared to JUnit 4. The migration would also modernize the test stack and align better with the broader Java ecosystem moving toward Jupiter.

Metadata

Metadata

Assignees

Labels

api: pubsubIssues related to the googleapis/java-pubsub API.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions