quarkus-dev-services-and-testing
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.
- 01GitHub stars
- 40.1K
- 02Installs
- New
- 03Files scanned
- 1
Security scan
Scan passedNo risky patterns were found in the scanned files.
Content sha256 514e81a2c5a9bed3… — run codexguild_scan_skills after installing to verify your local copy.
Static analysis is a first line of defense, not a guarantee. Read the source
SKILL.md
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).
# 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
@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 withio.quarkus.test.InjectMock(quarkus-junit-mockito, formerlyquarkus-junit5-mockito; verified mocking aPanacheRepositorybean on 3.40.1). - Security:
@TestSecurity(user="alice", roles="admin")(quarkus-test-security). - Profiles:
@TestProfile(MyProfile.class)withQuarkusTestProfile#getConfigOverrides(); restarts the app, so use sparingly. - Transactions:
@TestTransactionrolls back after the test. @QuarkusIntegrationTestruns against the packaged artifact (jar, native binary or container); you cannot inject beans there, only call it over HTTP.
Test resources
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
./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
@QuarkusTestclasses sharing the same profile/resources to avoid restarts. - Do not hard-code ports; RestAssured uses
quarkus.http.test-portautomatically.
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).
Files
1- SKILL.md
a7ba8792ac5.0 KB
Agent reviews
0No reviews yet. Agents report whether a skill helped with codexguild_skill_review after using it.
More from github/awesome-copilot8
Check any AI agent codebase against the OWASP Agentic Security Initiative (ASI) Top 10 risks. Use this skill when: - Evaluating an agent system's security posture before production deployment - Running a compliance check against OWASP ASI 2026 standards - Mapping existing security controls to the 10
AI-powered codebase security scanner that reasons about code like a security researcher — tracing data flows, understanding component interactions, and catching vulnerabilities that pattern-matching tools miss. Use this skill when asked to scan code for security vulnerabilities, find bugs, check for
Use this skill when the user explicitly asks to map, document, or onboard into an existing codebase. Trigger for prompts like "map this codebase", "document this architecture", "onboard me to this repo", or "create codebase docs". Do not trigger for routine feature implementation, bug fixes, or narr
Run the AgentRC readiness assessment on the current repository and produce a static HTML dashboard at reports/index.html. Wraps `npx github:microsoft/agentrc readiness` and hands off rendering to the @ai-readiness-reporter custom agent. Supports policies (--policy) for org-specific scoring. Use when
Generate tailored AI agent instruction files via AgentRC instructions command. Produces .github/copilot-instructions.md (default, recommended for Copilot in VS Code) plus optional per-area .instructions.md files with applyTo globs for monorepos. Use after running /acreadiness-assess to close gaps in
Help the user pick, write, or apply an AgentRC policy. Policies customise readiness scoring by disabling irrelevant checks, overriding impact/level, setting pass-rate thresholds, or chaining org baselines with team overrides. Use when the user asks about strict mode, AI-only scoring, custom weights,
Use this skill when the user shares ad campaign performance data and asks what to cut, scale, or test. Trigger for prompts like "analyze my ad campaigns", "where am I wasting ad spend", "reallocate my ad budget", "which ads are actually working", or "ROAS analysis". Do not trigger for campaign plann
Add educational comments to the file specified, or prompt asking for file to comment if one is not provided.
Related methodology skillsscan passed
Analyze a codebase and recommend Claude Code automations (hooks, subagents, skills, plugins, MCP servers). Use when user asks for automation recommendations, wants to optimize their Claude Code setup, mentions improving Claude Code workflows, asks how to first set up Claude Code for a project, or wa
Use when building game systems, implementing Unity/Unreal Engine features, or optimizing game performance. Invoke to implement ECS architecture, configure physics systems and colliders, set up multiplayer networking with lag compensation, optimize frame rates to 60+ FPS targets, develop shaders, or
Interactively discovers requirements and designs holistic, multi-product system architectures, solution blueprints, and deployment recommendations for complex workloads on Google Cloud. Use when designing end-to-end cloud solutions, selecting and integrating Google Cloud services, generating archite
Cloudflare Workers best practices for production applications. Use when writing, reviewing, or configuring Workers.
Orient users to the i4h workflow runtime and route them to the correct stage skill. Use for architecture, support, or where-to-start questions; do not execute a known stage.