423-frameworks-quarkus-testing-acceptance-tests

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Quarkus acceptance tests from Gherkin

基于Gherkin的Quarkus验收测试

Implement happy-path acceptance tests from Gherkin for Quarkus using real HTTP and infrastructure.
What is covered in this Skill?
  • Preconditions: .feature file in context; Quarkus project confirmed
  • Parsing and filtering scenarios tagged @acceptance / @acceptance-tests
  • BaseAcceptanceTest with @QuarkusTest, @QuarkusTestResource, and QuarkusTestResourceLifecycleManager for:
    • Testcontainers (PostgreSQL, Kafka) with dynamic config injection on startup
    • WireMock with wireMockServer.resetAll() in @BeforeEach to isolate stubs
  • Concrete acceptance test class extending BaseAcceptanceTest:
    • @DisplayName mirroring the Gherkin scenario title
    • Given (stubs + fixtures) / When (REST Assured HTTP call) / Then (response assertions + wireMock.verify)
  • WireMock JSON mapping files under classpath:wiremock/mappings/ with body files under __files/
  • Naming convention: *AT suffix for Failsafe; never *Test (Surefire) or *AcceptanceTest
  • Maven three-tier split: *Test → Surefire, *IT + *AT → Failsafe
  • Happy-path scope by default; escalate to negatives only when explicitly requested
Scope: Apply recommendations based on the reference rules and step workflow.
使用真实HTTP和基础设施,为Quarkus实现基于Gherkin的正常流程验收测试。
本Skill涵盖哪些内容?
  • 前置条件:上下文包含.feature文件;已确认是Quarkus项目
  • 解析并过滤带有@acceptance / @acceptance-tests标签的场景
  • 集成@QuarkusTest、@QuarkusTestResource和QuarkusTestResourceLifecycleManager的BaseAcceptanceTest,用于:
    • Testcontainers(PostgreSQL、Kafka),启动时注入动态配置
    • WireMock,在@BeforeEach中调用wireMockServer.resetAll()以隔离存根
  • 继承BaseAcceptanceTest的具体验收测试类:
    • @DisplayName与Gherkin场景标题一致
    • Given(存根 + 测试数据)/ When(REST Assured HTTP调用)/ Then(响应断言 + wireMock.verify)
  • WireMock JSON映射文件位于classpath:wiremock/mappings/下,body文件位于__files/下
  • 命名规范:使用AT后缀适配Failsafe;禁止使用Test(适配Surefire)或*AcceptanceTest
  • Maven三层拆分:*Test → Surefire,*IT + *AT → Failsafe
  • 默认仅覆盖正常流程;仅在明确要求时才扩展到异常场景
范围: 根据参考规则和步骤工作流应用建议。

Constraints

约束条件

Do not generate without a .feature file; compile before and verify after.
  • PRECONDITION: Gherkin
    .feature
    file must be in context — stop and ask if not provided
  • PRECONDITION: The project must use Quarkus — direct the user to @133 or @323 otherwise
  • MANDATORY: Run
    ./mvnw compile
    or
    mvn compile
    before applying any change
  • PREREQUISITE: Project must compile successfully before generating acceptance test scaffolding
  • BLOCKING CONDITION: Compilation errors must be resolved by the user before proceeding
  • NO EXCEPTIONS: Do not generate tests if the project fails to compile or the feature file is missing
  • VERIFY: Run
    ./mvnw clean verify
    or
    mvn clean verify
    after applying improvements
  • BEFORE APPLYING: Read the reference for detailed steps and safeguards
无.feature文件时不得生成;执行变更前后需分别编译和验证。
  • 前置条件:上下文必须包含Gherkin
    .feature
    文件——若未提供,请停止操作并询问用户
  • 前置条件:项目必须使用Quarkus——否则引导用户参考@133或@323
  • 强制要求:在应用任何变更前运行
    ./mvnw compile
    mvn compile
  • 先决条件:项目必须编译成功后才能生成验收测试脚手架
  • 阻塞条件:编译错误必须由用户解决后才能继续
  • 无例外:若项目编译失败或缺失feature文件,不得生成测试
  • 验证要求:应用改进后运行
    ./mvnw clean verify
    mvn clean verify
  • 应用前须知:阅读参考文档了解详细步骤和防护措施

When to use this skill

何时使用本Skill

  • Implement Quarkus acceptance tests from a Gherkin feature file
  • Set up BaseAcceptanceTest with Testcontainers and WireMock for Quarkus
  • Create WireMock JSON mapping files for external HTTP stubs in Quarkus acceptance tests
  • Configure Maven *AT naming convention and Failsafe plugin for Quarkus acceptance tests
  • 从Gherkin feature文件实现Quarkus验收测试
  • 为Quarkus配置集成Testcontainers和WireMock的BaseAcceptanceTest
  • 为Quarkus验收测试创建用于外部HTTP存根的WireMock JSON映射文件
  • 为Quarkus验收测试配置Maven *AT命名规范和Failsafe插件

Workflow

工作流

  1. Read reference and assess project context
Read
references/423-frameworks-quarkus-testing-acceptance-tests.md
and inspect the current project setup before proposing changes.
  1. Gather scope and decide target improvements
Identify requested outcomes, constraints, and the minimum safe set of changes to apply.
  1. Apply framework-aligned changes
Implement or refactor configuration/code following the reference patterns and project conventions.
  1. Run verification and report results
Execute appropriate build/tests and summarize what changed, what was verified, and any follow-up actions.
  1. 阅读参考文档并评估项目上下文
阅读
references/423-frameworks-quarkus-testing-acceptance-tests.md
,并检查当前项目配置后再提出变更建议。
  1. 明确范围并确定目标改进点
识别预期结果、约束条件,以及需应用的最小安全变更集。
  1. 应用符合框架规范的变更
遵循参考模式和项目约定实现或重构配置/代码。
  1. 执行验证并报告结果
运行相应的构建/测试,总结变更内容、验证情况及后续操作建议。

Reference

参考文档

For detailed guidance, examples, and constraints, see references/423-frameworks-quarkus-testing-acceptance-tests.md.
如需详细指南、示例和约束条件,请查看references/423-frameworks-quarkus-testing-acceptance-tests.md