Integration Testing

Integration Testing

Gives a coding agent a skill for designing and writing integration tests covering API endpoints, databases, external services and message queues, with reference guides and a scaffold script.

Skill files7 files

references/

scripts/

templates/

SKILL.md101 lines
1
---
2
name: integration-testing
3
description: >
4
Design and implement integration tests that verify component interactions, API
5
endpoints, database operations, and external service communication. Use for
6
integration test, API test, end-to-end component testing, and service layer
7
validation.
8
---
9
10
# Integration Testing
11
12
## Table of Contents
13
14
- [Overview](#overview)
15
- [When to Use](#when-to-use)
16
- [Quick Start](#quick-start)
17
- [Reference Guides](#reference-guides)
18
- [Best Practices](#best-practices)
19
20
## Overview
21
22
Integration testing validates that different components, modules, or services work correctly together. Unlike unit tests that isolate single functions, integration tests verify the interactions between multiple parts of your system including databases, APIs, external services, and infrastructure.
23
24
## When to Use
25
26
- Testing API endpoints with real database connections
27
- Verifying service-to-service communication
28
- Validating data flow across multiple layers
29
- Testing repository/DAO layer with actual databases
30
- Checking authentication and authorization flows
31
- Verifying message queue consumers and producers
32
- Testing third-party service integrations
33
34
## Quick Start
35
36
Minimal working example:
37
38
```javascript
39
// test/api/users.integration.test.js
40
const request = require("supertest");
41
const app = require("../../src/app");
42
const { setupTestDB, teardownTestDB } = require("../helpers/db");
43
44
describe("User API Integration Tests", () => {
45
beforeAll(async () => {
46
await setupTestDB();
47
});
48
49
afterAll(async () => {
50
await teardownTestDB();
51
});
52
53
beforeEach(async () => {
54
await clearUsers();
55
});
56
57
describe("POST /api/users", () => {
58
it("should create a new user with valid data", async () => {
59
const userData = {
60
email: "test@example.com",
61
name: "Test User",
62
password: "SecurePass123!",
63
};
64
// ... (see reference guides for full implementation)
65
```
66
67
## Reference Guides
68
69
Detailed implementations in the `references/` directory:
70
71
| Guide | Contents |
72
|---|---|
73
| [API Integration Testing](references/api-integration-testing.md) | API Integration Testing |
74
| [Database Integration Testing](references/database-integration-testing.md) | Database Integration Testing |
75
| [External Service Integration](references/external-service-integration.md) | External Service Integration |
76
| [Message Queue Integration](references/message-queue-integration.md) | Message Queue Integration |
77
78
## Best Practices
79
80
### ✅ DO
81
82
- Use real databases in integration tests (in-memory or containers)
83
- Test actual HTTP requests, not mocked responses
84
- Verify database state after operations
85
- Test transaction boundaries and rollbacks
86
- Include authentication/authorization in tests
87
- Test error scenarios and edge cases
88
- Use test containers for isolated environments
89
- Clean up data between tests
90
91
### ❌ DON'T
92
93
- Mock database connections in integration tests
94
- Skip testing error paths
95
- Leave test data in databases
96
- Use production databases for testing
97
- Ignore transaction management
98
- Test only happy paths
99
- Share state between tests
100
- Hardcode URLs or credentials
101

© AJ Geddes · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 6,373 prompts

More by @OpenSourceBuffGuy

See all
Website Clone Architect prompt image

Website Clone Architect

Reverse-engineers a website section by section, writes component specs, and hands them to parallel builder agents in git worktrees to rebuild it.

agent-skill, orchestrator, parallel-agents, multi-agent, plan-then-execute, web-development, frontend, codebase-analysis, scaffolding, css, html, nextjs, typescript, git, mcp, claude-code, for-developers, for-designers, long-form, advanced, technical-spec, task-decomposition, structured-output, design-systems, ui-ux, tool-use, checklist, report, vibe-coding

Italian Terrace Cafe Candid Portrait prompt image

Italian Terrace Cafe Candid Portrait

Generates a photorealistic candid shot of a woman in a white corset dress laughing at a sunny hotel terrace cafe, written as detailed JSON.

image-prompt, json-prompt, structured-output, photorealistic, portrait, woman, candid, fashion, cottagecore, natural-light, golden-hour, bokeh, summer, travel, cityscape, mountains, medium-shot, vibrant-colors, for-photographers, nano-banana, fashion-shoot, luxury

Night Street Photo With Leashed Cat prompt image

Night Street Photo With Leashed Cat

Generates a flash-lit night street photo of a blonde woman in a retro track jacket walking a hissing tabby cat on a leash.

image-prompt, json-prompt, nano-banana, structured-output, portrait, woman, animals, pet-portrait, night-scene, street-photography, candid, editorial, fashion, dramatic-lighting, photorealistic, vertical-format, medium-shot, graffiti, for-photographers, for-content-creators

1 view

Reviews

Loading reviews…

Discussion

Loading comments…