From 46ad214c190f2257d18a97c35882eadeee953d91 Mon Sep 17 00:00:00 2001 From: Blake Li Date: Fri, 20 Mar 2026 11:53:46 -0400 Subject: [PATCH 1/3] chore: Update GEMINI.md with test guides --- GEMINI.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/GEMINI.md b/GEMINI.md index d1d1fdf495..73c02f5bc4 100644 --- a/GEMINI.md +++ b/GEMINI.md @@ -65,8 +65,8 @@ mvn fmt:format The repository employs a multi-layered testing strategy to ensure the quality and correctness of the generated code: -* **Unit Tests:** Traditional unit tests for individual classes and methods. -* **Golden Unit Tests:** These tests generate code from test protos and compare the output to "golden" files, which are pre-approved versions of the generated code. These test cases exist inside the `gapic-generator-java` module. +* **Unit Tests:** Traditional unit tests for individual classes and methods. See [unit testing best practices](https://engdoc.corp.google.com/eng/doc/devguide/testing/unit/best-practices.md?cl=head&polyglot=java). +* **Golden Unit Tests:** These tests generate code from test protos and compare the output to "golden" files, which are pre-approved versions of the generated code. These test cases exist inside the `gapic-generator-java` module. See [GrpcServiceStubClassComposerTest](https://github.com/googleapis/sdk-platform-java/blob/main/gapic-generator-java/src/test/java/com/google/api/generator/gapic/composer/grpc/GrpcServiceStubClassComposerTest.java) for an example of golden unit tests. The steps for golden unit tests includes creating a test proto, load the test proto, generate from the test proto and compare the result with a golden file. * **Showcase Integration Tests:** These tests run the generated Showcase client against a local Showcase server to verify end-to-end functionality. This is the preferred way of testing integration tests. * **Golden Integration Tests:** These tests generate full client libraries for real Google Cloud APIs and compare them to golden versions. This is an older test strategy and showcase testing is preferred. @@ -74,7 +74,7 @@ Based on where the code changes are, we should add different tests, in general * If the changes are in `gax` or `api-common` only, you _must_ add traditional unit tests, you _may_ add showcase integration tests if you are modifying a public setting. * If the changes are in `gapic-generator-java` only, showcase integration tests are most likely not needed - * If they are in the `composer` module, you _must_ add golden unit tests, you _may_ add traditional unit tests for better coverage and easier testing. + * If they are in the `composer` module, you _must_ add golden unit tests, you _may_ add traditional unit tests for better coverage and easier testing. * If they are in the `parser` module, you _should_ add traditional unit tests with a test proto if possible, you _may_ add golden unit tests to easily see the changes. For example, [routing_rule_parser_testing](https://github.com/googleapis/sdk-platform-java/blob/main/gapic-generator-java/src/test/proto/routing_rule_parser_testing.proto) that is only used for testing [RoutingRuleParser](https://github.com/googleapis/sdk-platform-java/blob/main/gapic-generator-java/src/main/java/com/google/api/generator/gapic/protoparser/RoutingRuleParser.java). * If they are in `other modules(ast, model, writer etc.)`, you _must_ add traditional unit tests, you _may_ add golden unit tests to easily see the changes. - If the changes are in both `gax` and `gapic-generator-java`, you _must_ add all test layers, including traditional unit tests, golden unit tests and showcase integration tests. @@ -144,6 +144,6 @@ Showcase integration tests are run against a local server that implements the Sh specification. The format is `: `. The type should be one of the following: fix, feat, build, chore, docs, test, or refactor. - **Issues:** All significant changes should start with a GitHub issue. -- **Pull Requests:** All code changes must be submitted via a pull request and require review. +- **Pull Requests:** All code changes must be submitted via a pull request and require review. Before creating a PR, always pull latest from main, merge main to local branch and resolve any conflicts. - **Testing:** All new logic should be accompanied by tests. - For more details, see `CONTRIBUTING.md`. From d0840b3c58e8f5759896860c74203f9ccf5f42b3 Mon Sep 17 00:00:00 2001 From: Blake Li Date: Fri, 20 Mar 2026 11:54:17 -0400 Subject: [PATCH 2/3] Update GEMINI.md --- GEMINI.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GEMINI.md b/GEMINI.md index 73c02f5bc4..607d8d1f1d 100644 --- a/GEMINI.md +++ b/GEMINI.md @@ -74,7 +74,7 @@ Based on where the code changes are, we should add different tests, in general * If the changes are in `gax` or `api-common` only, you _must_ add traditional unit tests, you _may_ add showcase integration tests if you are modifying a public setting. * If the changes are in `gapic-generator-java` only, showcase integration tests are most likely not needed - * If they are in the `composer` module, you _must_ add golden unit tests, you _may_ add traditional unit tests for better coverage and easier testing. + * If they are in the `composer` module, you _must_ add golden unit tests, you _may_ add traditional unit tests for better coverage and easier testing. * If they are in the `parser` module, you _should_ add traditional unit tests with a test proto if possible, you _may_ add golden unit tests to easily see the changes. For example, [routing_rule_parser_testing](https://github.com/googleapis/sdk-platform-java/blob/main/gapic-generator-java/src/test/proto/routing_rule_parser_testing.proto) that is only used for testing [RoutingRuleParser](https://github.com/googleapis/sdk-platform-java/blob/main/gapic-generator-java/src/main/java/com/google/api/generator/gapic/protoparser/RoutingRuleParser.java). * If they are in `other modules(ast, model, writer etc.)`, you _must_ add traditional unit tests, you _may_ add golden unit tests to easily see the changes. - If the changes are in both `gax` and `gapic-generator-java`, you _must_ add all test layers, including traditional unit tests, golden unit tests and showcase integration tests. From e83cbddc55e55445a1402cd61f8f13a41309eda3 Mon Sep 17 00:00:00 2001 From: Blake Li Date: Fri, 20 Mar 2026 12:01:17 -0400 Subject: [PATCH 3/3] Update GEMINI.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- GEMINI.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GEMINI.md b/GEMINI.md index 607d8d1f1d..5f36cd8021 100644 --- a/GEMINI.md +++ b/GEMINI.md @@ -66,7 +66,7 @@ mvn fmt:format The repository employs a multi-layered testing strategy to ensure the quality and correctness of the generated code: * **Unit Tests:** Traditional unit tests for individual classes and methods. See [unit testing best practices](https://engdoc.corp.google.com/eng/doc/devguide/testing/unit/best-practices.md?cl=head&polyglot=java). -* **Golden Unit Tests:** These tests generate code from test protos and compare the output to "golden" files, which are pre-approved versions of the generated code. These test cases exist inside the `gapic-generator-java` module. See [GrpcServiceStubClassComposerTest](https://github.com/googleapis/sdk-platform-java/blob/main/gapic-generator-java/src/test/java/com/google/api/generator/gapic/composer/grpc/GrpcServiceStubClassComposerTest.java) for an example of golden unit tests. The steps for golden unit tests includes creating a test proto, load the test proto, generate from the test proto and compare the result with a golden file. +* **Golden Unit Tests:** These tests generate code from test protos and compare the output to "golden" files, which are pre-approved versions of the generated code. These test cases exist inside the `gapic-generator-java` module. See [GrpcServiceStubClassComposerTest](https://github.com/googleapis/sdk-platform-java/blob/main/gapic-generator-java/src/test/java/com/google/api/generator/gapic/composer/grpc/GrpcServiceStubClassComposerTest.java) for an example of golden unit tests. The steps for golden unit tests include creating a test proto, loading the test proto, generating from the test proto, and comparing the result with a golden file. * **Showcase Integration Tests:** These tests run the generated Showcase client against a local Showcase server to verify end-to-end functionality. This is the preferred way of testing integration tests. * **Golden Integration Tests:** These tests generate full client libraries for real Google Cloud APIs and compare them to golden versions. This is an older test strategy and showcase testing is preferred.