第 10 章 测试 Quarkus 应用程序
默认情况下,当您测试 Quarkus 应用程序时,Maven 将使用 测试配置 配置集。但是,您可以使用 Maven Surefire 插件为测试创建自定义配置配置集。
先决条件
- 您有一个使用 Apache Maven 创建的 Quarkus 项目。
流程
编辑以下示例以满足您的测试要求,其中 <
;profile_name> 是测试配置集的名称:<project> [...] <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>${surefire-plugin.version}</version> <configuration> <systemPropertyVariables> <quarkus.test.profile><profile_name></quarkus.test.profile> <buildDirectory>${project.build.directory}</buildDirectory> [...] </systemPropertyVariables> </configuration> </plugin> </plugins> </build> [...] </project>
注意
您不能在原生模式中使用自定义测试配置配置集。原生测试始终使用 prod 配置集运行。