rest-api-test-generator

Solid

Generates REST API tests using RestAssured or MockMvc with loop prevention and incremental validation. Triggers on: "test API endpoints", "generate API tests", "test REST API", "create integration tests".

API & Backend 7 stars 3 forks Updated today MIT

Install

View on GitHub

Quality Score: 81/100

Stars 20%
30
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

# REST API Test Generator ## Instructions ### Step 1: API Discovery Ask the user: 1. Which endpoint? (e.g., `POST /api/users`) 2. Framework? (RestAssured, MockMvc) 3. Authentication? (Bearer token, Basic auth, none) 4. Test environment? (Mock server, local, staging) 5. Request body example and expected response codes Provide an upfront estimate: **15-20 credits per test scenario**. ### Step 2: Generate 3 Scenarios Per Batch Generate exactly 3 test scenarios: 1. **Success case** (e.g., 201 Created) 2. **Validation error** (e.g., 400 Bad Request) 3. **Business logic error** (e.g., 409 Conflict, 404 Not Found) Use RestAssured template: ```java @Test void shouldCreateUser_whenValidRequest() { given() .contentType(ContentType.JSON) .body(validUserRequest) .when() .post("/api/users") .then() .statusCode(201) .body("id", notNullValue()) .body("email", equalTo("test@example.com")); } ``` **STOP after 3 tests.** Ask the user to run and confirm responses match. ### Step 3: Validation Gate Validation command: ```bash python scripts/validate_api_tests.py <TestClassName> --base-url http://localhost:8080 ``` Do NOT generate more tests until the user confirms the current batch passes. ### Step 4: Fix or Skip (Max 2 Attempts) If tests fail: - **Attempt 1:** Check request/response format, Content-Type, auth token - **Attempt 2:** Adjust assertions (nested paths, flexible matchers like `hasKey`, `anyOf`) - **After 2 failu...

Details

Author
timwukp
Repository
timwukp/agent-skills-best-practice
Created
4 months ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category