بنقرة واحدة
backend-testing
Backend testing guide — unit, integration, API contract, database, load testing
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Backend testing guide — unit, integration, API contract, database, load testing
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Backend development guide — API design, data modeling, business logic, security, performance
Codebase second brain workflow for AI agents — use repo maps and capability maps before deep code reads
Multi-agent coordination skill — task decomposition, dependency tracking, handoff protocol, conflict resolution
Frontend development guide — UI implementation, component architecture, state management, performance
Frontend testing guide — unit, integration, visual regression, accessibility, E2E for UI
Project management skill — sprint planning, backlog grooming, risk management, reporting, stakeholder communication
| name | backend-testing |
| version | 1.0.0 |
| description | Backend testing guide — unit, integration, API contract, database, load testing |
| requires | [] |
| task_types | ["testing","backend-testing","qa","api-testing"] |
| applies_to_tags | ["testing","backend","qa","api","database"] |
beforeEach(async () => {
await db.delete(tasks) // clean slate
testTask = await db.insert(tasks).values(mockTask).returning()
})
test('PATCH /tasks/:id updates status', async () => {
const res = await request(app)
.patch(`/api/vault/tasks/${testTask.id}`)
.send({ status: 'done' })
expect(res.status).toBe(200)
expect(res.body.data.status).toBe('done')
// Verify DB was actually updated
const row = await db.query.tasks.findFirst({ where: eq(tasks.id, testTask.id) })
expect(row.status).toBe('done')
})
Đặc biệt quan trọng với RelayHQ — server và web phải khớp:
// contract-alignment.test.ts pattern
test('GET /api/vault/read-model returns expected shape', async () => {
const res = await request(app).get('/api/vault/read-model')
expect(res.body).toMatchObject({
tasks: expect.arrayContaining([
expect.objectContaining({
id: expect.any(String),
status: expect.any(String),
title: expect.any(String),
})
])
})
})
Chạy contract tests sau mỗi thay đổi API response shape.
EXPLAIN ANALYZE// k6 smoke test
export default function () {
const res = http.get('http://localhost:44210/api/vault/read-model')
check(res, { 'status 200': (r) => r.status === 200 })
sleep(1)
}
// Target: p95 < 200ms, no errors under 50 concurrent users
Chạy load test trước khi ship feature có query mới.
// Mock HTTP calls, không mock database
vi.mock('../services/external-llm', () => ({
generateSummary: vi.fn().mockResolvedValue('mocked summary')
}))
Date.now() cho time-dependent logic| Layer | Minimum |
|---|---|
| Service / business logic | 90% |
| Route handlers | 85% (via integration) |
| Utilities / helpers | 95% |
| Migration files | manual verification |