integration-testing by aj-geddes/useful-ai-prompts
npx skills add https://github.com/aj-geddes/useful-ai-prompts --skill integration-testing集成测试用于验证不同的组件、模块或服务能否正确地协同工作。与隔离测试单个函数的单元测试不同,集成测试验证的是系统中多个部分之间的交互,包括数据库、API、外部服务和基础设施。
最小工作示例:
// test/api/users.integration.test.js
const request = require("supertest");
const app = require("../../src/app");
const { setupTestDB, teardownTestDB } = require("../helpers/db");
describe("User API Integration Tests", () => {
beforeAll(async () => {
await setupTestDB();
});
afterAll(async () => {
await teardownTestDB();
});
beforeEach(async () => {
await clearUsers();
});
describe("POST /api/users", () => {
it("should create a new user with valid data", async () => {
const userData = {
email: "test@example.com",
name: "Test User",
password: "SecurePass123!",
};
// ... (完整实现请参阅参考指南)
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
references/ 目录下的详细实现:
每周安装量
131
代码仓库
GitHub 星标数
121
首次出现
2026年1月21日
安全审计
安装于
opencode115
gemini-cli108
codex105
claude-code102
cursor101
github-copilot91
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.
Minimal working example:
// test/api/users.integration.test.js
const request = require("supertest");
const app = require("../../src/app");
const { setupTestDB, teardownTestDB } = require("../helpers/db");
describe("User API Integration Tests", () => {
beforeAll(async () => {
await setupTestDB();
});
afterAll(async () => {
await teardownTestDB();
});
beforeEach(async () => {
await clearUsers();
});
describe("POST /api/users", () => {
it("should create a new user with valid data", async () => {
const userData = {
email: "test@example.com",
name: "Test User",
password: "SecurePass123!",
};
// ... (see reference guides for full implementation)
Detailed implementations in the references/ directory:
| Guide | Contents |
|---|---|
| API Integration Testing | API Integration Testing |
| Database Integration Testing | Database Integration Testing |
| External Service Integration | External Service Integration |
| Message Queue Integration | Message Queue Integration |
Weekly Installs
131
Repository
GitHub Stars
121
First Seen
Jan 21, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode115
gemini-cli108
codex105
claude-code102
cursor101
github-copilot91