generate-integration-tests — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited generate-integration-tests (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
This skill generates a comprehensive integration test class for a given Java source file. It detects the project's framework (Spring Boot, Quarkus, or Micronaut), identifies the class type (repository, controller, or service), and produces framework-appropriate integration tests using Testcontainers for real database and external service containers.
/generate-integration-tests <path-to-java-class>Argument: $ARGUMENTS — the file path (relative or absolute) to the target .java source file. Required; no default.
/generate-integration-tests src/main/java/com/example/repository/OrderRepository.javaGenerates src/test/java/com/example/repository/integration/OrderRepositoryTest.java with Testcontainers database setup, application context bootstrap, and test methods for each repository method.
For a Spring Boot repository with a PostgreSQL database, the skill generates a test class with @SpringBootTest, @Testcontainers, @ServiceConnection on a PostgreSQLContainer, @BeforeEach for data cleanup, and @Nested inner classes grouping tests by method with shouldBehaviorWhenCondition naming and Arrange-Act-Assert structure.
| Class Type | Detection Signal | Test Strategy |
|---|---|---|
| Repository | Extends JpaRepository/CrudRepository/PanacheRepository; @Repository annotation | Database container, CRUD + custom query tests |
| Controller | @RestController/@Controller (Spring), @Path (Quarkus), @Controller (Micronaut) | Full-stack boot, HTTP endpoint tests (MockMvc / RestAssured / HttpClient) |
| Service | @Service/@Component/@ApplicationScoped/@Singleton with external dependencies | Testcontainers for Kafka/Redis/RabbitMQ, WireMock for HTTP |
| No integration points | None of the above | Rejected — suggest /generate-unit-tests |
You are generating an integration test class for a Java source file. Follow each step below in order.
Read the file at $ARGUMENTS.
If no argument is provided, inform the user:
"Please provide a path to a Java source file. Usage: /generate-integration-tests path/to/MyClass.java"Then stop.
If the file does not exist, inform the user:
"File not found: {path}. Please verify the path and try again."Then stop.
If the file is not a `.java` file, inform the user:
"Expected a.javafile but got{extension}. Please provide a Java source file."
Then stop.
Analyze the class and extract:
package declarationclass, interface, record, or enumScan the project for build files:
pom.xml (Maven)build.gradle or build.gradle.kts (Gradle)If both exist: Ask the user which build tool to use.
If neither exists: Inform the user that no supported build file was found and stop.
Record the build tool type and all build file paths (root + child modules for multi-module projects).
Read reference/framework-detection.md now for the complete detection matrix and procedure.
Scan the build files for framework markers. Record the detected framework (SPRING_BOOT, QUARKUS, or MICRONAUT) and the signal that identified it.
If no supported framework is detected:
"No supported framework detected. This skill requires Spring Boot (3.1+), Quarkus (3.0+), or Micronaut (4.0+). For non-framework Java code, try /generate-unit-tests instead."Then stop.
If multiple frameworks are detected:
"Multiple frameworks detected: {framework1} and {framework2}. Please confirm which framework this project uses."
Then stop and wait for user response.
Check existing test files and build configuration for JUnit version signals:
src/test/java for import patterns:org.junit.jupiter → JUnit 5org.junit.Test (without jupiter) → JUnit 4junit-jupiter or junit-bom 5.x → JUnit 5junit:junit:4.x → JUnit 4If JUnit 5 is detected or no signal is found (default): Proceed.
If JUnit 4 is detected:
"Integration test generation requires JUnit 5 (all supported frameworks — Spring Boot, Quarkus, and Micronaut — use JUnit 5 test extensions). Please add the JUnit 5 dependency to your project and try again."
Then stop.
Scan the build files for Testcontainers dependencies:
org.testcontainers groupIdorg.testcontainers in any dependencyIf Testcontainers is not found, inform the user with exact coordinates for their build tool. Read reference/database-detection.md for the dependency coordinates and version requirements. Note that H2 in-memory tests do not require Testcontainers.
If Testcontainers is found, check the version:
<testcontainers.version> property (Maven) or ext['testcontainers.version'] (Gradle)testcontainers-bom version in <dependencyManagement> (Maven) or platform(...) (Gradle)"Your Testcontainers version ({version}) may be incompatible with modern Docker runtimes (API v1.40+ required). Upgrade to 1.21.0+ by setting <testcontainers.version>1.21.0</testcontainers.version> in your build file." // NOTE: Requires Testcontainers 1.21.0+ and a Docker-compatible runtime (API v1.40+).
// If tests fail with "client version is too old", upgrade Testcontainers in your build file.Analyze the target class to determine its type:
| Class Type | Detection Signals |
|---|---|
| REPOSITORY | Extends JpaRepository, CrudRepository, PagingAndSortingRepository (Spring Data), PanacheRepository, PanacheEntityBase (Quarkus Panache), CrudRepository, PageableRepository (Micronaut Data); or annotated with @Repository |
| CONTROLLER | Annotated with @RestController or @Controller (Spring), @Path (Quarkus JAX-RS), @Controller (Micronaut) |
| SERVICE | Annotated with @Service, @Component (Spring), @ApplicationScoped, @Singleton, @RequestScoped (Quarkus CDI), @Singleton, @Prototype (Micronaut); AND has at least one dependency on an external system (database, message broker, cache, HTTP API) |
If none of the above signals match:
"No integration points found in{ClassName}(no database access, HTTP endpoints, or external service calls). Try/generate-unit-testsfor unit test coverage instead."
Then stop.
Scan the class's constructor parameters and injected fields for external system dependencies:
Database: Any repository-type dependency (see REPOSITORY signals above)
Message Brokers:
KafkaTemplate, RabbitTemplate, JmsTemplate@Channel, @Outgoing, @Incoming (SmallRye Reactive Messaging), @ConnectorAttribute@KafkaClient, @KafkaListener, @RabbitClient, @RabbitListenerCache:
RedisTemplate, StringRedisTemplate, CacheManagerRedisDataSource, ReactiveRedisDataSourceRedisCommands, StatefulRedisConnectionHTTP Clients:
RestTemplate, WebClient, RestClient@RestClient annotated interfaces@Client annotated interfaces or injected HttpClientRecord each integration point with its type and the Testcontainers module (or WireMock) needed.
Read reference/database-detection.md now for the complete detection matrix and procedure.
Follow the detection priority order (driver dependency → datasource URL → JPA dialect). Default to H2 in-memory if no database type can be determined.
Determine the test file location using the .integration subpackage convention:
src/main/java/com/example/repository/OrderRepository.java)src/test/java with an .integration subpackage:src/test/java/com/example/repository/integration/OrderRepositoryTest.java<ClassName>TestCheck if the test file already exists. If it does, proceed to Step 13 (Supplementation) instead of generating a new file.
This step applies only when classType is REPOSITORY.
Read the framework-specific patterns reference file for the detected framework:
Also read examples/spring-boot-repository.md for a complete input/output example.
Extract repository methods:
@Query annotations (Spring/Micronaut), @NamedQuery (Quarkus), or derived query methods (e.g., findByStatus, countByCustomerName)JpaRepository<Order, Long> → entity is Order, ID is Long)Read the entity class to understand its fields, relationships, and constraints. This informs test data creation.
Generate the test class with:
@ServiceConnection (Spring) or DevServices (Quarkus) or Test Resources (Micronaut). For H2 default: test property source instead.@Autowired (Spring), @Inject (Quarkus/Micronaut)@BeforeEach to clean data between tests (for Spring/Micronaut), or @TestTransaction per test (for Quarkus)@Nested inner classes by method name (PascalCase). For Quarkus, do NOT use @Nested classes — Quarkus CDI rejects interceptor bindings (@TestTransaction) on inner class methods. Instead, use flat test methods with descriptive names.shouldBehaviorWhenCondition camelCaseassertThat(...))Write the generated test file to the resolved path.
This step applies only when classType is CONTROLLER.
Read the framework-specific patterns reference file for the detected framework (same files as Step 10).
Extract endpoint mappings:
GET, POST, PUT, DELETE, PATCH)@RequestMapping/@GetMapping/etc. in Spring, @Path/@GET/etc. in Quarkus, @Get/@Post/etc. in Micronaut)@Valid, @NotNull, @Size, etc.)Generate the test class with:
@AutoConfigureMockMvc.@Autowired MockMvc mockMvcgiven().when().then())@Inject @Client("/") HttpClient client@BeforeEach@Nested inner classes by endpoint. For Quarkus, use flat test methods (no @Nested — same CDI limitation as repository tests).@Valid request bodies, generate tests that violate each validation constraintWrite the generated test file to the resolved path.
This step applies only when classType is SERVICE.
Read the framework-specific patterns reference file for the detected framework.
For each integration point detected in Step 7, set up the appropriate test infrastructure:
| Integration Point | Testcontainers Module | Setup Pattern |
|---|---|---|
| Database (via repository) | Per database-detection.md | Same as repository tests |
| Kafka | org.testcontainers:kafka | KafkaContainer (Spring @ServiceConnection), DevServices (Quarkus), Test Resources (Micronaut) |
| Redis | org.testcontainers:redis (or GenericContainer) | Redis container with exposed port 6379 |
| RabbitMQ | org.testcontainers:rabbitmq | RabbitMQContainer |
| HTTP API (external) | None | WireMock (WireMockExtension) with stub setup |
Generate the test class with:
Write the generated test file to the resolved path.
This step only applies when a test file already exists at the resolved path (from Step 9).
@Nested class name (e.g., class FindByStatus covers findByStatus)@Test method@Nested classes with test methods following all the rules above"All public methods in{ClassName}already have integration test coverage in{TestClassName}."
Make no changes.
Now generate the integration test class for the file at: $ARGUMENTS
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.