agentleFS
emvnuelemvnuel/skills/testing-patterns/SKILL.md

testing-patterns

Skill2 starsChanged 11 months agoMITView on GitHub

REST integration testing patterns with JUnit 5, Mockito, RestAssured. Use when writing integration tests that mock external dependencies, use Testcontainers/H2 for databases, and test endpoints with raw JSON bodies.

47 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use intelligent-routing, bash-linux and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • SKB3002Skill

    intelligent-routing

    Automatic agent selection and intelligent task routing. Analyzes user requests and automatically selects the best specialist agent(s) without requiring explicit user mentions.

    Also in 5 projects that use this

  • xenitV1Skill

    bash-linux

    Bash/Linux terminal patterns. Critical commands, piping, error handling, scripting. Use when working on macOS or Linux systems.

    Also in 7 projects that use this

  • xenitV1Skill

    red-team-tactics

    Red team tactics principles based on MITRE ATT&CK. Attack phases, detection evasion, reporting.

    Also in 7 projects that use this

  • ChrisWilesSkill

    formik-patterns

    Formik form handling with validation patterns. Use when building forms, implementing validation, or handling form submission.

    Also in 3 projects that use this

  • SKB3002Skill

    nextjs-react-expert

    React and Next.js performance optimization from Vercel Engineering. Use when building React components, optimizing performance, eliminating waterfalls, reducing bundle size, reviewing code for performance issues, or implementing server/client-side optimizations.

    Also in 3 projects that use this

  • adybaSkill

    safe-workflow

    SAFe Agentic Workflow orchestrator. Teaches the full SAFe methodology adapted for AI agents: pattern discovery, exit states, quality gates, agent personas, and specs-driven development. Use when setting up a project with SAFe workflow, understanding the multi-agent methodology, or coordinating work across agent personas. Triggers: "SAFe workflow", "agent workflow", "safe harness", "specs-driven", "exit states", "quality gates", "multi-agent workflow".

    Also in 3 projects that use this

  • +5 more from xenitV1

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 4 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 31 edited versions we read keep these.

  • 4

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Write integration tests for REST endpoints using Quarkus test framework.

    line 8
  2. Distinctive:

    Use: Test full request/response cycle through REST layer

    line 46
  3. Distinctive:

    Use: Test against real PostgreSQL/MySQL

    line 58
  4. Distinctive:

    Use: Test with exact JSON payloads (no object serialization)

    line 70

“Common” is measured: kept by at least 6 in 10 of the 31 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

REST Integration Testing Patterns

Write integration tests for REST endpoints using Quarkus test framework.


Quick Start

Basic REST integration test with RestAssured:

@QuarkusTest
class OrderResourceTest {

    @Test
    void shouldCreateOrder() {
        given()
            .contentType(ContentType.JSON)
            .body("""
                {
                    "customerId": "cust-123",
                    "items": [{"productId": "prod-1", "quantity": 2}]
                }
                """)
        .when()
            .post("/orders")
        .then()
            .statusCode(201)
            .body("id", notNullValue())
            .body("status", equalTo("PENDING"));
    }
}

Core Patterns

REST Integration Tests

Use: Test full request/response cycle through REST layer
Stack: @QuarkusTest + RestAssured
Cookbook: rest-integration-tests.md

Mocking External Dependencies

Use: Isolate tests from external HTTP services, queues, etc.
Stack: @InjectMock with Mockito
Cookbook: mocking-dependencies.md

Database with Testcontainers

Use: Test against real PostgreSQL/MySQL
Stack: Quarkus DevServices or @Testcontainers
Cookbook: testcontainers-setup.md

Database with H2

Use: Fast in-memory alternative when container not needed
Stack: H2 with test profile
Cookbook: h2-setup.md

Raw JSON Request Bodies

Use: Test with exact JSON payloads (no object serialization)
Stack: Text blocks + JsonPath assertions
Cookbook: json-request-bodies.md

Test Structure & Lifecycle

Use: Organize tests with JUnit 5 features
Stack: @Nested, @BeforeEach, naming conventions
Cookbook: test-structure.md


Quick Reference

PatternWhen to UseKey Annotation/Tool
REST IntegrationTest endpoint behavior@QuarkusTest
Mock DependenciesIsolate from external services@InjectMock
TestcontainersNeed real database behaviorDevServices / Container
H2 In-MemoryFast tests, simple queries%test profile
Raw JSON BodiesExact payload controlText blocks
Nested Test ClassesGroup related scenarios@Nested

Cookbook Index

Core Testing: REST Integration Tests · Test Structure

Dependencies: Mocking Dependencies

Database: Testcontainers Setup · H2 Setup

Request/Response: JSON Request Bodies

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.