xref: /aosp_15_r20/external/sdk-platform-java/test/integration/goldens/README.md (revision 882aa7c72c3cd3b66e72a261bdd69b93f7de7670)
1*882aa7c7SMatt Gilbride# Goldens Files For Integration Test
2*882aa7c7SMatt Gilbride
3*882aa7c7SMatt GilbrideThis folder contains goldens files that are expected to be generated from Java Microgenerator
4*882aa7c7SMatt Gilbrideagainst different APIs. For example `redis` folder has all the Java source files in the generated
5*882aa7c7SMatt GilbrideRedis client library. They are all actual Java files, but used as goldens.
6*882aa7c7SMatt Gilbride
7*882aa7c7SMatt Gilbride## Purpose
8*882aa7c7SMatt Gilbride
9*882aa7c7SMatt GilbrideWhen running integration test for the Java Microgenerator using the below command,
10*882aa7c7SMatt Gilbridethe goldens files in this folder will be used to compare with the actual generated Java source
11*882aa7c7SMatt Gilbridefiles.
12*882aa7c7SMatt GilbrideIf they are not identical, then the integration test will fail.
13*882aa7c7SMatt Gilbride
14*882aa7c7SMatt Gilbride```sh
15*882aa7c7SMatt Gilbridebazelisk test //test/integration:redis
16*882aa7c7SMatt Gilbride```
17*882aa7c7SMatt Gilbride
18*882aa7c7SMatt Gilbride## How To Update Goldens
19*882aa7c7SMatt Gilbride
20*882aa7c7SMatt GilbrideIf the actual generated Java source files are not identical with the goldens files, and we want to
21*882aa7c7SMatt Gilbrideupdate the goldens using source files. Run the command below to overwrite the goldens files
22*882aa7c7SMatt Gilbridein `redis` folder.
23*882aa7c7SMatt Gilbride
24*882aa7c7SMatt Gilbride```sh
25*882aa7c7SMatt Gilbridebazelisk run //test/integration:update_redis
26*882aa7c7SMatt Gilbride```
27*882aa7c7SMatt Gilbride
28*882aa7c7SMatt Gilbride## Adding new integration tests
29*882aa7c7SMatt Gilbride
30*882aa7c7SMatt GilbrideIf you are adding a new API for integration testing, be sure to add it in the `BUILD.bazel` under
31*882aa7c7SMatt Gilbridethe `Integration Test Rules` and add the `java_gapic_test` rules for the new API under
32*882aa7c7SMatt Gilbridethe `API Library Rules` section.
33*882aa7c7SMatt Gilbride
34*882aa7c7SMatt GilbrideYou need to manually create a new directory for your new API under the `test/integration/goldens`
35*882aa7c7SMatt Gilbridewith the same name you've used for the `Integration Test Rules`. Then when you run the command to
36*882aa7c7SMatt Gilbrideupdate goldens (above), it will automatically create the goldens needed.
37