-
Notifications
You must be signed in to change notification settings - Fork 129
feat: Migrate to JUnit 5 and add parallel test execution #4042
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @AbgarSim, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request undertakes a significant modernization effort by migrating the project's testing infrastructure from JUnit 4 to JUnit 5. This transition not only updates the core testing framework but also introduces parallel test execution, aiming to drastically improve the speed and efficiency of the test suite. The changes span across dependency management, test class annotations, and assertion method usage, ensuring full compatibility with the latest JUnit platform features. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request does a great job migrating the project to JUnit 5 and enabling parallel test execution. The changes in pom.xml and the introduction of junit-platform.properties are correct.
However, the migration of the test source code is incomplete. Many test files still use assertions from JUnit 4 (org.junit.Assert), which can lead to a mixed test dependency setup. For a clean migration, it's best to consistently use JUnit 5's assertions from org.junit.jupiter.api.Assertions.
I've left a few specific comments to highlight this issue. A global search-and-replace for org.junit.Assert imports should help clean this up across the codebase.
google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/BigQueryExceptionTest.java
Show resolved
Hide resolved
google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/InsertAllRequestTest.java
Outdated
Show resolved
Hide resolved
google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/JobTest.java
Outdated
Show resolved
Hide resolved
google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java
Outdated
Show resolved
Hide resolved
google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/QueryParameterValueTest.java
Outdated
Show resolved
Hide resolved
af000f8 to
02aae0e
Compare
c2cf29a to
4caa1c9
Compare
pom.xml
Outdated
| <version>4.13.2</version> | ||
| <groupId>org.junit.jupiter</groupId> | ||
| <artifactId>junit-jupiter</artifactId> | ||
| <version>5.11.4</version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our SDK actually manages a set of common dependencies upstream here: https://github.com/googleapis/sdk-platform-java/blob/b68791d074c02e02a5ccf2f937a5922749a14f56/gapic-generator-java-pom-parent/pom.xml#L40 (a bit of a convoluted process to get here).
You should be able to reference the ${junit.version} there so it's centrally managed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I'm not quite sure how this repo is linked to gapic-generator-java-pom-parent and just using ${junit.version} fails locally.
However, following the trail of parents of this repo i was able to reach native-image-shared-config pom which has <junit-vintage-engine.version>5.11.4</junit-vintage-engine.version>
I used this placeholder instead, please advice if this is acceptable or how to reach ${junit.version}
google-cloud-bigquery/src/test/resources/junit-platform.properties
Outdated
Show resolved
Hide resolved
|
Thanks again @AbgarSim, really appreciate the work going into migrating to JUnit 5! The tests generally look good. I added a few comments mostly about dependencies. For the the wildcard imports ( Additionally, we have the dependencies check reporting: |
b78fec2 to
6c3b014
Compare
6c3b014 to
62566a8
Compare
|
Hi @lqiu96 thanks for the feedback! I've pushed the following adjustments:
|
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
Fixes #4041 ☕️
Before Optimisitation

After Optimisation

If you write sample code, please follow the samples format.