Skip to content

Commit 18d3c44

Browse files
committed
Add mention of AOT file generation from tests in docs
1 parent 88b0c0a commit 18d3c44

File tree

2 files changed

+35
-2
lines changed

2 files changed

+35
-2
lines changed

docs/src/main/asciidoc/appcds.adoc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,13 @@ java -XX:AOTCache=app.aot -jar quarkus-run.jar
116116
----
117117
====
118118

119+
=== Generate the AOT cache from integration tests
120+
121+
Although Quarkus can generate an AOT cache file without ever running the production application, the file will not be optimal as the application was never exercised against any load. To alleviate this,
122+
Quarkus can use the existing testsuite of tests annotated with `@QuarkusIntegrationTest` to create an AOT cache file.
123+
See the xref:getting-started-testing.adoc#generating-an-aot-cache-during-integration-tests[corresponding section] in the Testing Guide for more details.
124+
125+
119126
=== Usage in containers
120127

121128
When building container images using the `quarkus-container-image-jib` extension, Quarkus automatically takes care of all the steps needed to generate the archive and make it usable at runtime in the container.

docs/src/main/asciidoc/getting-started-testing.adoc

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,6 +1354,32 @@ packaged as *jar*, you can use:
13541354

13551355
as an argument to Maven/Gradle when launching the test. This will make the application wait until a remote JVM debugger is connected to port `5005`.
13561356

1357+
[#generating-an-aot-cache-during-integration-tests]
1358+
=== Generating an AOT cache during integration tests
1359+
1360+
When targeting JDK 25+, you can instruct Quarkus to generate an AOT cache (`app.aot`) while running `@QuarkusIntegrationTest` tests.
1361+
Enable this by adding the following system property to your integration test run:
1362+
1363+
[source,bash]
1364+
----
1365+
-Dquarkus.package.jar.appcds.use-aot=true
1366+
----
1367+
1368+
With this flag, the tested application is launched with the JVM’s AOT cache output option, and an `app.aot` file is produced next to the built jar (for example `target/quarkus-app/app.aot`). You can then run the application with:
1369+
1370+
[source,bash]
1371+
----
1372+
java -XX:AOTCache=app.aot -jar quarkus-run.jar
1373+
----
1374+
1375+
This feature essentially turns the existing testsuite into a training run.
1376+
1377+
[NOTE]
1378+
====
1379+
- The feature requires JDK 25 or newer.
1380+
- The effectiveness of the generated cache depends on how representative your integration tests are of production startup and early traffic.
1381+
====
1382+
13571383
=== Launching containers
13581384

13591385
When `@QuarkusIntegrationTest` results in launching a container (because the application was built with `quarkus.container-image.build` set to `true`), the container is launched on a predictable container network. This facilitates writing integration tests that need to launch services to support the application.
@@ -1496,13 +1522,13 @@ You can use this tag to isolate the `@QuarkusTest` test in a specific execution
14961522

14971523
[NOTE]
14981524
--
1499-
Currently `@QuarkusTest` and `@QuarkusIntegrationTest` should not be run in the same test run.
1525+
Currently `@QuarkusTest` and `@QuarkusIntegrationTest` should not be run in the same test run.
15001526

15011527
For Maven, this means that the former should be run by the surefire plugin while the latter should be run by the failsafe plugin.
15021528

15031529
For Gradle, this means the two types of tests should belong to different source sets.
15041530

1505-
.Source set configuration example
1531+
.Source set configuration example
15061532
[%collapsible]
15071533
====
15081534
[source,kotlin,subs=attributes+]

0 commit comments

Comments
 (0)