quarkus-dev-services-and-testing — скилл для GitHub Copilot
Помогает настраивать Dev Services, писать тесты с @QuarkusTest и запускать интеграционные проверки в проектах на Quarkus.
gh skill install github/awesome-copilot quarkus-dev-services-and-testingЧто делает quarkus-dev-services-and-testing
Скилл ориентирует агента в специфике тестирования Quarkus: автозапуске контейнеров Dev Services для PostgreSQL, Kafka или Redis, моках через @InjectMock и проверках API с RestAssured. Он удерживает ассистента от смешивания общих рецептов Testcontainers с архитектурой Quarkus.
Внутри собраны правила для изоляции тестов: откат транзакций через @TestTransaction, роли в @TestSecurity и управление профилями @TestProfile. Скилл напоминает избегать частых перезапусков контекста и запрещает внедрять конфигурацию ресурсов прямо в тестовые классы.
Для запуска Dev Services обязателен Docker или Podman. Без передачи флага -DskipITs=false интеграционные тесты с аннотацией @QuarkusIntegrationTest будут тихо пропущены при вызове mvnw verify.
Какие задачи решает
- Настроить Dev Services для локальной базы без ручной конфигурации
- Написать тест API с RestAssured и моками
@InjectMock - Задать тестовые роли безопасности через
@TestSecurity - Запустить тесты
@QuarkusIntegrationTestбез тихого пропуска в Maven
Примеры запросов агенту
- Помоги написать тест для GreetingResource с использованием RestAssured и проверкой статуса 200
- Настрой Dev Services для PostgreSQL с фиксированным портом и переиспользованием контейнера
- Объясни, почему ./mvnw verify пропускает интеграционные тесты с @QuarkusIntegrationTest
Как установить quarkus-dev-services-and-testing
1GitHub CLI
gh skill install github/awesome-copilot quarkus-dev-services-and-testing2Вручную: положить файлы
.github/skills/quarkus-dev-services-and-testing/SKILL.md1Через Skills CLI (Vercel)
npx skills add github/awesome-copilot --skill quarkus-dev-services-and-testing -a claude-code2Вручную: положить файлы
~/.claude/skills/quarkus-dev-services-and-testing/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/quarkus-dev-services-and-testing/
Вручную: положить файлы
.agents/skills/quarkus-dev-services-and-testing/SKILL.mdДля всех проектов — ~/.agents/skills/
Вручную: положить файлы
.cursor/skills/quarkus-dev-services-and-testing/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
Командой платформы
gemini skills install https://github.com/github/awesome-copilot --path skills/quarkus-dev-services-and-testingВручную: положить файлы
.devin/skills/quarkus-dev-services-and-testing/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Claude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о quarkus-dev-services-and-testing
Как установить quarkus-dev-services-and-testing в GitHub Copilot?
Выполните команду gh skill install github/awesome-copilot quarkus-dev-services-and-testing или поместите файл по пути .github/skills/quarkus-dev-services-and-testing/SKILL.md.
Что делает quarkus-dev-services-and-testing?
Скилл даёт ассистенту контекст для работы с экосистемой тестирования Quarkus: контейнерами Dev Services, аннотациями @QuarkusTest, профилями и непрерывным тестированием.
Почему падают нативные интеграционные тесты на macOS?
Если нативный бинарник собирается в контейнере на macOS или Windows, получается файл формата Linux ELF, который завершается ошибкой с кодом 126; для них требуется локальная сборка через Mandrel или GraalVM.
Исходный текст
SKILL.md · MIT
---
name: quarkus-dev-services-and-testing
description: 'Quarkus Dev Services and testing: zero-config containers, @QuarkusTest, @QuarkusIntegrationTest, test resources, RestAssured, @InjectMock, profiles and continuous testing. Use when writing or fixing tests in a Quarkus project.'
---
# Quarkus Dev Services and Testing
Check the project's Quarkus version first. Framework-neutral Testcontainers usage can use the optional `java-testcontainers` skill if installed (otherwise see <https://java.testcontainers.org/>); this skill covers only Quarkus-specific features.
## Dev Services
In dev and test modes Quarkus starts containers (PostgreSQL, MySQL, Kafka, Redis, Keycloak, ...) automatically when the related extension is present and no connection is configured (Docker or Podman required).
```properties
# Global switch
quarkus.devservices.enabled=true
%dev.quarkus.datasource.devservices.image-name=postgres:17
# Reuse container across restarts (also requires testcontainers.reuse.enable=true in ~/.testcontainers.properties)
quarkus.datasource.devservices.reuse=true
# Fixed port (optional)
quarkus.datasource.devservices.port=5432
# Share between apps in dev mode
quarkus.kafka.devservices.shared=true
```
Disable one with `quarkus.<ext>.devservices.enabled=false`; configuring a URL/host explicitly also disables it. Dev UI (`/q/dev-ui`) lists running services.
## Tests
```java
@QuarkusTest
class GreetingResourceTest {
@Test
void hello() {
given().when().get("/hello").then().statusCode(200).body(is("Hello"));
}
}
```
Dependencies, test scope: `io.quarkus:quarkus-junit` (3.31+, what the 3.40 template generates) or `quarkus-junit5` (3.27 template; still published and resolvable on 3.40) and `io.rest-assured:rest-assured`. Keep whichever the project already uses.
- Inject beans in tests with `@Inject`; mock CDI beans with `io.quarkus.test.InjectMock` (`quarkus-junit-mockito`, formerly `quarkus-junit5-mockito`; verified mocking a `PanacheRepository` bean on 3.40.1).
- Security: `@TestSecurity(user="alice", roles="admin")` (`quarkus-test-security`).
- Profiles: `@TestProfile(MyProfile.class)` with `QuarkusTestProfile#getConfigOverrides()`; restarts the app, so use sparingly.
- Transactions: `@TestTransaction` rolls back after the test.
- `@QuarkusIntegrationTest` runs against the packaged artifact (jar, native binary or container); you cannot inject beans there, only call it over HTTP.
## Test resources
```java
public class WireMockResource implements QuarkusTestResourceLifecycleManager {
public Map<String,String> start() { /* start, return config overrides */ return Map.of(); }
public void stop() { }
}
@QuarkusTest
@WithTestResource(WireMockResource.class) // io.quarkus.test.common.WithTestResource
class MyTest { }
```
`@WithTestResource` (verified on 3.40.1) applies to the annotated test class; Quarkus restarts the app when the set of resources changes. The older `@QuarkusTestResource` still compiles and runs on 3.40.1 but applies globally to all tests unless `restrictToAnnotatedClass = true`. Do not put `@ConfigProperty` injection points for resource-supplied values in a test class: test classes are scanned as beans, and the app fails to start for other test classes that lack the resource. Prefer Dev Services over custom resources when an extension supports it.
## Running
```bash
./mvnw test # unit/@QuarkusTest
./mvnw verify -DskipITs=false # also runs *IT via maven-failsafe-plugin
```
Gotcha: `*IT` classes (`@QuarkusIntegrationTest`) are run by Failsafe in the `verify` phase, and need the `quarkus-maven-plugin` `build` goal and the failsafe config (with `java.util.logging.manager` and `maven.home` system properties) generated by the project template. `./mvnw test` silently skips them, and the 3.27 and 3.40 templates also set `<skipITs>true</skipITs>`, so plain `./mvnw verify` skips them too (verified): pass `-DskipITs=false` (or `-Dnative`, whose profile flips it). With `-Dnative` and a container build on macOS or Windows, the binary is a Linux ELF and the IT fails with `Exit code is: '126'`; use a local Mandrel/GraalVM build for those.
Continuous testing: run `./mvnw quarkus:dev` and press `r` to start or re-run tests and `p` to pause them (`h` lists the hotkeys); once running, tests re-run on code changes (`quarkus.test.continuous-testing=enabled|paused|disabled`).
Verified on Quarkus 3.40.1 (JDK 26, Docker Desktop): `@QuarkusTest` with Dev Services PostgreSQL (`postgres:18` by default), `@TestTransaction`, `@TestProfile`, `@TestSecurity`, `@InjectMock`, `*IT` via Failsafe. `@QuarkusTest` and Dev Services on 3.27.6 as well.
## Checklist
- Use Dev Services before writing a custom resource.
- Keep `@QuarkusTest` classes sharing the same profile/resources to avoid restarts.
- Do not hard-code ports; RestAssured uses `quarkus.http.test-port` automatically.
See also: <https://quarkus.io/guides/dev-services>, <https://quarkus.io/guides/getting-started-testing>; for upgrades use `quarkus update` (<https://quarkus.io/guides/update-quarkus>).
© github · MIT · github/awesome-copilot