
Backend Testing
- 3 installs
- 404 repo stars
- Updated August 5, 2026
- aiskillstore/marketplace
backend-testing is a Claude Code skill that writes unit, integration and API tests for backends using Jest, Pytest or Mocha.
About
backend-testing writes unit, integration and API tests for backend applications. It supports Jest, Pytest and Mocha, and covers test setup, mocking, TDD and coverage thresholds for REST APIs, database operations and business logic. A developer uses it when testing endpoints, auth flows or logic, or building an automated test pipeline.
- Writes unit, integration and API tests for backends
- Covers Jest, Pytest and Mocha with mocking and coverage strategies
- Includes a TDD-oriented step-by-step setup with jest.config and fixtures
Backend Testing by the numbers
- 3 all-time installs (skills.sh)
- Ranked #1,649 of 2,153 Testing & QA skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
backend-testing capabilities & compatibility
- Capabilities
- backend testing · unit testing · integration testing · api testing
- Use cases
- testing · ci cd
What backend-testing says it does
Write comprehensive backend tests including unit tests, integration tests, and API tests.
Handles Jest, Pytest, Mocha, testing strategies, mocking, and test coverage.
npx skills add https://github.com/aiskillstore/marketplace --skill backend-testingAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 3 |
|---|---|
| repo stars | ★ 404 |
| Last updated | August 5, 2026 |
| Repository | aiskillstore/marketplace ↗ |
What it does
Write unit, integration and API tests for a backend using Jest, Pytest or Mocha, with mocking and coverage targets.
Who is it for?
Adding unit, integration and API tests to a backend with proper mocking and coverage.
Skip if: Frontend or UI testing and end-to-end browser tests.
When should I use this skill?
A developer needs to test REST APIs, database operations, auth flows or business logic.
What you get
A tested backend with unit, integration and API tests meeting a coverage target.
- unit tests
- integration tests
- API endpoint tests
By the numbers
- default coverage threshold 80%
- 3 test types (unit, integration, API)
- multi-step instruction workflow
Files
Backend Testing
When to use this skill
Specific situations that should trigger this skill:
- New feature development: Write tests first using TDD (Test-Driven Development)
- Adding API endpoints: Test success and failure cases for REST APIs
- Bug fixes: Add tests to prevent regressions
- Before refactoring: Write tests that guarantee existing behavior
- CI/CD setup: Build automated test pipelines
Input Format
Format and required/optional information to collect from the user:
Required information
- Framework: Express, Django, FastAPI, Spring Boot, etc.
- Test tool: Jest, Pytest, Mocha/Chai, JUnit, etc.
- Test target: API endpoints, business logic, DB operations, etc.
Optional information
- Database: PostgreSQL, MySQL, MongoDB (default: in-memory DB)
- Mocking library: jest.mock, sinon, unittest.mock (default: framework built-in)
- Coverage target: 80%, 90%, etc. (default: 80%)
- E2E tool: Supertest, TestClient, RestAssured (optional)
Input example
Test the user authentication endpoints for an Express.js API:
- Framework: Express + TypeScript
- Test tool: Jest + Supertest
- Target: POST /auth/register, POST /auth/login
- DB: PostgreSQL (in-memory for tests)
- Coverage: 90% or aboveInstructions
Step-by-step task order to follow precisely.
Step 1: Set up the test environment
Install and configure the test framework and tools.
Tasks:
- Install test libraries
- Configure test database (in-memory or separate DB)
- Separate environment variables (.env.test)
- Configure jest.config.js or pytest.ini
Example (Node.js + Jest + Supertest):
npm install --save-dev jest ts-jest @types/jest supertest @types/supertestjest.config.js:
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
roots: ['<rootDir>/src'],
testMatch: ['**/__tests__/**/*.test.ts'],
collectCoverageFrom: [
'src/**/*.ts',
'!src/**/*.d.ts',
'!src/__tests__/**'
],
coverageThreshold: {
global: {
branches: 80,
functions: 80,
lines: 80,
statements: 80
}
},
setupFilesAfterEnv: ['<rootDir>/src/__tests__/setup.ts']
};setup.ts (global test configuration):
import { db } from '../database';
// Reset DB before each test
beforeEach(async () => {
await db.migrate.latest();
await db.seed.run();
});
// Clean up after each test
afterEach(async () => {
await db.migrate.rollback();
});
// Close connection after all tests complete
afterAll(async () => {
await db.destroy();
});Step 2: Write Unit Tests (business logic)
Write unit tests for individual functions and classes.
Tasks:
- Test pure functions (no dependencies)
- Isolate dependencies via mocking
- Test edge cases (boundary values, exceptions)
- AAA pattern (Arrange-Act-Assert)
Decision criteria:
- No external dependencies (DB, API) -> pure Unit Test
- External dependencies present -> use Mock/Stub
- Complex logic -> test various input cases
Example (password validation function):
// src/utils/password.ts
export function validatePassword(password: string): { valid: boolean; errors: string[] } {
const errors: string[] = [];
if (password.length < 8) {
errors.push('Password must be at least 8 characters');
}
if (!/[A-Z]/.test(password)) {
errors.push('Password must contain uppercase letter');
}
if (!/[a-z]/.test(password)) {
errors.push('Password must contain lowercase letter');
}
if (!/\d/.test(password)) {
errors.push('Password must contain number');
}
if (!/[!@#$%^&*]/.test(password)) {
errors.push('Password must contain special character');
}
return { valid: errors.length === 0, errors };
}
// src/__tests__/utils/password.test.ts
import { validatePassword } from '../../utils/password';
describe('validatePassword', () => {
it('should accept valid password', () => {
const result = validatePassword('Password123!');
expect(result.valid).toBe(true);
expect(result.errors).toHaveLength(0);
});
it('should reject password shorter than 8 characters', () => {
const result = validatePassword('Pass1!');
expect(result.valid).toBe(false);
expect(result.errors).toContain('Password must be at least 8 characters');
});
it('should reject password without uppercase', () => {
const result = validatePassword('password123!');
expect(result.valid).toBe(false);
expect(result.errors).toContain('Password must contain uppercase letter');
});
it('should reject password without lowercase', () => {
const result = validatePassword('PASSWORD123!');
expect(result.valid).toBe(false);
expect(result.errors).toContain('Password must contain lowercase letter');
});
it('should reject password without number', () => {
const result = validatePassword('Password!');
expect(result.valid).toBe(false);
expect(result.errors).toContain('Password must contain number');
});
it('should reject password without special character', () => {
const result = validatePassword('Password123');
expect(result.valid).toBe(false);
expect(result.errors).toContain('Password must contain special character');
});
it('should return multiple errors for invalid password', () => {
const result = validatePassword('pass');
expect(result.valid).toBe(false);
expect(result.errors.length).toBeGreaterThan(1);
});
});Step 3: Integration Test (API endpoints)
Write integration tests for API endpoints.
Tasks:
- Test HTTP requests/responses
- Success cases (200, 201)
- Failure cases (400, 401, 404, 500)
- Authentication/authorization tests
- Input validation tests
Checklist:
- [x] Verify status code
- [x] Validate response body structure
- [x] Confirm database state changes
- [x] Validate error messages
Example (Express.js + Supertest):
// src/__tests__/api/auth.test.ts
import request from 'supertest';
import app from '../../app';
import { db } from '../../database';
describe('POST /auth/register', () => {
it('should register new user successfully', async () => {
const response = await request(app)
.post('/api/auth/register')
.send({
email: 'test@example.com',
username: 'testuser',
password: 'Password123!'
});
expect(response.status).toBe(201);
expect(response.body).toHaveProperty('user');
expect(response.body).toHaveProperty('accessToken');
expect(response.body.user.email).toBe('test@example.com');
// Verify the record was actually saved to DB
const user = await db.user.findUnique({ where: { email: 'test@example.com' } });
expect(user).toBeTruthy();
expect(user.username).toBe('testuser');
});
it('should reject duplicate email', async () => {
// Create first user
await request(app)
.post('/api/auth/register')
.send({
email: 'test@example.com',
username: 'user1',
password: 'Password123!'
});
// Second attempt with same email
const response = await request(app)
.post('/api/auth/register')
.send({
email: 'test@example.com',
username: 'user2',
password: 'Password123!'
});
expect(response.status).toBe(409);
expect(response.body.error).toContain('already exists');
});
it('should reject weak password', async () => {
const response = await request(app)
.post('/api/auth/register')
.send({
email: 'test@example.com',
username: 'testuser',
password: 'weak'
});
expect(response.status).toBe(400);
expect(response.body.error).toBeDefined();
});
it('should reject missing fields', async () => {
const response = await request(app)
.post('/api/auth/register')
.send({
email: 'test@example.com'
// username, password omitted
});
expect(response.status).toBe(400);
});
});
describe('POST /auth/login', () => {
beforeEach(async () => {
// Create test user
await request(app)
.post('/api/auth/register')
.send({
email: 'test@example.com',
username: 'testuser',
password: 'Password123!'
});
});
it('should login with valid credentials', async () => {
const response = await request(app)
.post('/api/auth/login')
.send({
email: 'test@example.com',
password: 'Password123!'
});
expect(response.status).toBe(200);
expect(response.body).toHaveProperty('accessToken');
expect(response.body).toHaveProperty('refreshToken');
expect(response.body.user.email).toBe('test@example.com');
});
it('should reject invalid password', async () => {
const response = await request(app)
.post('/api/auth/login')
.send({
email: 'test@example.com',
password: 'WrongPassword123!'
});
expect(response.status).toBe(401);
expect(response.body.error).toContain('Invalid credentials');
});
it('should reject non-existent user', async () => {
const response = await request(app)
.post('/api/auth/login')
.send({
email: 'nonexistent@example.com',
password: 'Password123!'
});
expect(response.status).toBe(401);
});
});Step 4: Authentication/Authorization Tests
Test JWT tokens and role-based access control.
Tasks:
- Confirm 401 when accessing without a token
- Confirm successful access with a valid token
- Test expired token handling
- Role-based permission tests
Example:
describe('Protected Routes', () => {
let accessToken: string;
let adminToken: string;
beforeEach(async () => {
// Regular user token
const userResponse = await request(app)
.post('/api/auth/register')
.send({
email: 'user@example.com',
username: 'user',
password: 'Password123!'
});
accessToken = userResponse.body.accessToken;
// Admin token
const adminResponse = await request(app)
.post('/api/auth/register')
.send({
email: 'admin@example.com',
username: 'admin',
password: 'Password123!'
});
// Update role to 'admin' in DB
await db.user.update({
where: { email: 'admin@example.com' },
data: { role: 'admin' }
});
// Log in again to get a new token
const loginResponse = await request(app)
.post('/api/auth/login')
.send({
email: 'admin@example.com',
password: 'Password123!'
});
adminToken = loginResponse.body.accessToken;
});
describe('GET /api/auth/me', () => {
it('should return current user with valid token', async () => {
const response = await request(app)
.get('/api/auth/me')
.set('Authorization', `Bearer ${accessToken}`);
expect(response.status).toBe(200);
expect(response.body.user.email).toBe('user@example.com');
});
it('should reject request without token', async () => {
const response = await request(app)
.get('/api/auth/me');
expect(response.status).toBe(401);
});
it('should reject request with invalid token', async () => {
const response = await request(app)
.get('/api/auth/me')
.set('Authorization', 'Bearer invalid-token');
expect(response.status).toBe(403);
});
});
describe('DELETE /api/users/:id (Admin only)', () => {
it('should allow admin to delete user', async () => {
const targetUser = await db.user.findUnique({ where: { email: 'user@example.com' } });
const response = await request(app)
.delete(`/api/users/${targetUser.id}`)
.set('Authorization', `Bearer ${adminToken}`);
expect(response.status).toBe(200);
});
it('should forbid non-admin from deleting user', async () => {
const targetUser = await db.user.findUnique({ where: { email: 'user@example.com' } });
const response = await request(app)
.delete(`/api/users/${targetUser.id}`)
.set('Authorization', `Bearer ${accessToken}`);
expect(response.status).toBe(403);
});
});
});Step 5: Mocking and Test Isolation
Mock external dependencies to isolate tests.
Tasks:
- Mock external APIs
- Mock email sending
- Mock file system
- Mock time-related functions
Example (mocking an external API):
// src/services/emailService.ts
export async function sendVerificationEmail(email: string, token: string): Promise<void> {
const response = await fetch('https://api.sendgrid.com/v3/mail/send', {
method: 'POST',
headers: { 'Authorization': `Bearer ${process.env.SENDGRID_API_KEY}` },
body: JSON.stringify({
to: email,
subject: 'Verify your email',
html: `<a href="https://example.com/verify?token=${token}">Verify</a>`
})
});
if (!response.ok) {
throw new Error('Failed to send email');
}
}
// src/__tests__/services/emailService.test.ts
import { sendVerificationEmail } from '../../services/emailService';
// Mock fetch
global.fetch = jest.fn();
describe('sendVerificationEmail', () => {
beforeEach(() => {
(fetch as jest.Mock).mockClear();
});
it('should send email successfully', async () => {
(fetch as jest.Mock).mockResolvedValueOnce({
ok: true,
status: 200
});
await expect(sendVerificationEmail('test@example.com', 'token123'))
.resolves
.toBeUndefined();
expect(fetch).toHaveBeenCalledWith(
'https://api.sendgrid.com/v3/mail/send',
expect.objectContaining({
method: 'POST'
})
);
});
it('should throw error if email sending fails', async () => {
(fetch as jest.Mock).mockResolvedValueOnce({
ok: false,
status: 500
});
await expect(sendVerificationEmail('test@example.com', 'token123'))
.rejects
.toThrow('Failed to send email');
});
});Output format
Defines the exact format that outputs must follow.
Basic structure
project/
├── src/
│ ├── __tests__/
│ │ ├── setup.ts # Global test configuration
│ │ ├── utils/
│ │ │ └── password.test.ts # Unit tests
│ │ ├── services/
│ │ │ └── emailService.test.ts
│ │ └── api/
│ │ ├── auth.test.ts # Integration tests
│ │ └── users.test.ts
│ └── ...
├── jest.config.js
└── package.jsonTest run scripts (package.json)
{
"scripts": {
"test": "jest",
"test:watch": "jest --watch",
"test:coverage": "jest --coverage",
"test:ci": "jest --ci --coverage --maxWorkers=2"
}
}Coverage report
$ npm run test:coverage
--------------------------|---------|----------|---------|---------|
File | % Stmts | % Branch | % Funcs | % Lines |
--------------------------|---------|----------|---------|---------|
All files | 92.5 | 88.3 | 95.2 | 92.8 |
auth/ | 95.0 | 90.0 | 100.0 | 95.0 |
middleware.ts | 95.0 | 90.0 | 100.0 | 95.0 |
routes.ts | 95.0 | 90.0 | 100.0 | 95.0 |
utils/ | 90.0 | 85.0 | 90.0 | 90.0 |
password.ts | 90.0 | 85.0 | 90.0 | 90.0 |
--------------------------|---------|----------|---------|---------|Constraints
Rules and prohibitions that must be strictly followed.
Required rules (MUST)
1. Test isolation: Each test must be runnable independently
- Reset state with beforeEach/afterEach
- Do not depend on test execution order
2. Clear test names: The name must convey what the test verifies
- ✅ 'should reject duplicate email'
- ❌ 'test1'
3. AAA pattern: Arrange (setup) - Act (execute) - Assert (verify) structure
- Improves readability
- Clarifies test intent
Prohibited (MUST NOT)
1. No production DB: Tests must use a separate or in-memory DB
- Risk of losing real data
- Cannot isolate tests
2. No real external API calls: Mock all external services
- Removes network dependency
- Speeds up tests
- Reduces costs
3. No Sleep/Timeout abuse: Use fake timers for time-based tests
- jest.useFakeTimers()
- Prevents test slowdowns
Security rules
- No hardcoded secrets: Never hardcode API keys or passwords in test code
- Separate environment variables: Use .env.test file
Examples
Example 1: Python FastAPI tests (Pytest)
Situation: Testing a FastAPI REST API
User request:
Test the user API built with FastAPI using pytest.Final result:
# tests/conftest.py
import pytest
from fastapi.testclient import TestClient
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from app.main import app
from app.database import Base, get_db
# In-memory SQLite for tests
SQLALCHEMY_DATABASE_URL = "sqlite:///./test.db"
engine = create_engine(SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False})
TestingSessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
@pytest.fixture(scope="function")
def db_session():
Base.metadata.create_all(bind=engine)
db = TestingSessionLocal()
try:
yield db
finally:
db.close()
Base.metadata.drop_all(bind=engine)
@pytest.fixture(scope="function")
def client(db_session):
def override_get_db():
try:
yield db_session
finally:
db_session.close()
app.dependency_overrides[get_db] = override_get_db
yield TestClient(app)
app.dependency_overrides.clear()
# tests/test_auth.py
def test_register_user_success(client):
response = client.post("/auth/register", json={
"email": "test@example.com",
"username": "testuser",
"password": "Password123!"
})
assert response.status_code == 201
assert "access_token" in response.json()
assert response.json()["user"]["email"] == "test@example.com"
def test_register_duplicate_email(client):
# First user
client.post("/auth/register", json={
"email": "test@example.com",
"username": "user1",
"password": "Password123!"
})
# Duplicate email
response = client.post("/auth/register", json={
"email": "test@example.com",
"username": "user2",
"password": "Password123!"
})
assert response.status_code == 409
assert "already exists" in response.json()["detail"]
def test_login_success(client):
# Register
client.post("/auth/register", json={
"email": "test@example.com",
"username": "testuser",
"password": "Password123!"
})
# Login
response = client.post("/auth/login", json={
"email": "test@example.com",
"password": "Password123!"
})
assert response.status_code == 200
assert "access_token" in response.json()
def test_protected_route_without_token(client):
response = client.get("/auth/me")
assert response.status_code == 401
def test_protected_route_with_token(client):
# Register and get token
register_response = client.post("/auth/register", json={
"email": "test@example.com",
"username": "testuser",
"password": "Password123!"
})
token = register_response.json()["access_token"]
# Access protected route
response = client.get("/auth/me", headers={
"Authorization": f"Bearer {token}"
})
assert response.status_code == 200
assert response.json()["email"] == "test@example.com"Best practices
Quality improvements
1. TDD (Test-Driven Development): Write tests before writing code
- Clarifies requirements
- Improves design
- Naturally achieves high coverage
2. Given-When-Then pattern: Write tests in BDD style
it('should return 404 when user not found', async () => {
// Given: a non-existent user ID
const nonExistentId = 'non-existent-uuid';
// When: attempting to look up that user
const response = await request(app).get(`/users/${nonExistentId}`);
// Then: 404 response
expect(response.status).toBe(404);
});3. Test Fixtures: Reusable test data
const validUser = {
email: 'test@example.com',
username: 'testuser',
password: 'Password123!'
};Efficiency improvements
- Parallel execution: Speed up tests with Jest's
--maxWorkersoption - Snapshot Testing: Save snapshots of UI components or JSON responses
- Coverage thresholds: Enforce minimum coverage in jest.config.js
Common Issues
Issue 1: Test failures caused by shared state between tests
Symptom: Passes individually but fails when run together
Cause: DB state shared due to missing beforeEach/afterEach
Fix:
beforeEach(async () => {
await db.migrate.rollback();
await db.migrate.latest();
});Issue 2: "Jest did not exit one second after the test run"
Symptom: Process does not exit after tests complete
Cause: DB connections, servers, etc. not cleaned up
Fix:
afterAll(async () => {
await db.destroy();
await server.close();
});Issue 3: Async test timeout
Symptom: "Timeout - Async callback was not invoked"
Cause: Missing async/await or unhandled Promise
Fix:
// Bad
it('should work', () => {
request(app).get('/users'); // Promise not handled
});
// Good
it('should work', async () => {
await request(app).get('/users');
});References
Official docs
Learning resources
Tools
- Istanbul/nyc - code coverage
- nock - HTTP mocking
- faker.js - test data generation
Metadata
Version
- Current version: 1.0.0
- Last updated: 2025-01-01
- Compatible platforms: Claude, ChatGPT, Gemini
Related skills
- api-design: Design APIs alongside tests
- authentication-setup: Test authentication systems
Tags
#testing #backend #Jest #Pytest #unit-test #integration-test #TDD #API-test
{
"schema_version": "2.0",
"meta": {
"generated_at": "2026-03-09T08:22:21.504Z",
"slug": "supercent-io-backend-testing",
"source_url": "https://github.com/supercent-io/skills-template/tree/main/.agent-skills/backend-testing/",
"source_ref": "main",
"model": "claude",
"analysis_version": "3.0.0",
"source_type": "community",
"content_hash": "d5287b52eaf8ba76592b18ca761cafaf89b3d244ba96a830f06b5929b61845ab",
"tree_hash": "9b80b4524782fa0f4a8afb3b2af53f999dfe6c302c891dbb1f8e1ece4ca3aecc"
},
"skill": {
"name": "backend-testing",
"description": "Write comprehensive backend tests including unit tests, integration tests, and API tests. Use when testing REST APIs, database operations, authentication flows, or business logic. Handles Jest, Pytest, Mocha, testing strategies, mocking, and test coverage.",
"summary": "Comprehensive backend testing skill for writing unit, integration, and API tests with Jest, Pytest, and Mocha.",
"icon": "📦",
"version": "1.0.0",
"author": "supercent-io",
"license": "MIT",
"tags": [
"testing",
"backend",
"jest",
"pytest",
"unit-test",
"integration-test"
],
"supported_tools": [
"claude",
"codex",
"claude-code"
],
"risk_factors": [
"scripts",
"network",
"filesystem",
"env_access",
"external_commands"
]
},
"security_audit": {
"risk_level": "low",
"is_blocked": false,
"safe_to_publish": true,
"summary": "This is a legitimate backend testing skill. All 137 static findings are false positives - they represent documentation examples of standard testing practices (npm install commands, HTTP test requests using Supertest, test file paths, and .env.test configuration). No malicious behavior detected.",
"critical_findings": [],
"high_findings": [],
"medium_findings": [],
"low_findings": [
{
"title": "External Commands in Documentation",
"description": "The skill contains 52 examples of shell commands (npm install, jest config) in code blocks. These are documentation examples, not actual code execution.",
"locations": [
{
"file": "SKILL.md",
"line_start": 40,
"line_end": 844
}
],
"confidence": 0.95,
"confidence_reasoning": "All external command references are in markdown code blocks as documentation examples, not executable code. The skill is a testing guide, not a script."
},
{
"title": "Network Requests in Test Examples",
"description": "The skill shows HTTP test requests using Supertest and mocked fetch calls. This is legitimate API testing behavior.",
"locations": [
{
"file": "SKILL.md",
"line_start": 231,
"line_end": 830
}
],
"confidence": 0.95,
"confidence_reasoning": "Network patterns are test HTTP requests using Supertest for testing REST APIs - standard testing practice. The skill explicitly requires mocking external APIs (rule on line 597)."
},
{
"title": "Environment Variable Access",
"description": "The skill references environment variables for test configuration, which is a testing best practice.",
"locations": [
{
"file": "SKILL.md",
"line_start": 60,
"line_end": 609
}
],
"confidence": 0.9,
"confidence_reasoning": "Environment variable access is in .env.test file examples for test isolation - this is the recommended secure practice for handling test configuration."
}
],
"dangerous_patterns": [],
"files_scanned": 2,
"total_lines": 861,
"audit_model": "claude",
"audited_at": "2026-03-09T08:22:21.504Z",
"risk_factors": [
"scripts",
"network",
"filesystem",
"env_access",
"external_commands"
],
"risk_factor_evidence": [
{
"factor": "external_commands",
"evidence": [
{
"file": "SKILL.md",
"line_start": 40,
"line_end": 844
}
]
},
{
"factor": "network",
"evidence": [
{
"file": "SKILL.md",
"line_start": 231,
"line_end": 830
}
]
},
{
"factor": "filesystem",
"evidence": [
{
"file": "SKILL.md",
"line_start": 94,
"line_end": 841
}
]
},
{
"factor": "env_access",
"evidence": [
{
"file": "SKILL.md",
"line_start": 60,
"line_end": 635
}
]
}
]
},
"content": {
"user_title": "Write Backend Tests",
"value_statement": "Write comprehensive backend tests including unit tests, integration tests, and API tests using Jest, Pytest, or Mocha with proper mocking and coverage analysis.",
"seo_keywords": [
"testing",
"Codex testing skill",
"unit test writing",
"integration testing",
"API testing skill",
"Jest testing",
"Pytest testing",
"test-driven development",
"mocking backend",
"Claude Codex testing"
],
"actual_capabilities": [
"Write unit tests for business logic functions using Jest, Pytest, or Mocha",
"Create integration tests for REST API endpoints with proper status code validation",
"Implement authentication and authorization tests with JWT tokens",
"Set up test databases and mocking for external dependencies",
"Configure test coverage thresholds and generate coverage reports",
"Apply TDD and BDD testing patterns with proper test isolation"
],
"limitations": [
"Does not execute tests - only generates test code",
"Does not set up CI/CD pipelines",
"Does not provide debugging of test failures",
"Requires user to install test dependencies manually"
],
"use_cases": [
{
"title": "Developer Writing New API Tests",
"description": "A developer needs to write tests for a new Express.js REST API endpoint. The skill generates comprehensive unit and integration tests.",
"target_user": "Backend developers building REST APIs"
},
{
"title": "QA Engineer Creating Test Suite",
"description": "A QA engineer needs to create a full test suite for a Python FastAPI backend with database testing.",
"target_user": "QA engineers and testers"
},
{
"title": "Team Implementing TDD",
"description": "A development team adopting Test-Driven Development needs guidance on writing tests before code.",
"target_user": "Development teams practicing TDD"
}
],
"prompt_templates": [
{
"title": "Basic API Test Request",
"prompt": "Write unit tests for a user authentication function that validates passwords. Use Jest with TypeScript. Test cases: valid password, too short, missing uppercase, missing number.",
"scenario": "Writing unit tests for a single function"
},
{
"title": "Integration Test Request",
"prompt": "Create integration tests for a POST /users endpoint in Express.js using Jest and Supertest. Test: successful creation, duplicate email, missing fields. Use in-memory database.",
"scenario": "Testing API endpoints with database"
},
{
"title": "Authentication Test Request",
"prompt": "Write tests for JWT authentication: login success, login with wrong password, accessing protected route without token, accessing with invalid token, admin-only route access.",
"scenario": "Testing authentication and authorization"
},
{
"title": "Full Test Suite Request",
"prompt": "Set up a complete test suite for a Django REST API using Pytest. Include: test configuration, fixture setup, unit tests for serializers, integration tests for views, authentication tests, coverage configuration.",
"scenario": "Setting up comprehensive test infrastructure"
}
],
"output_examples": [
{
"input": "Write unit tests for password validation",
"output": [
"Test suite with 7 test cases covering all password requirements",
"Tests for valid password, length check, uppercase, lowercase, number, special character",
"Uses AAA pattern (Arrange-Act-Assert)"
]
},
{
"input": "Create integration tests for user registration API",
"output": [
"Tests for successful registration, duplicate email rejection, validation errors",
"Verifies database state changes after successful registration",
"Uses Supertest for HTTP requests"
]
}
],
"best_practices": [
"Use test isolation with beforeEach/afterEach to reset state between tests",
"Apply AAA pattern (Arrange-Act-Assert) for clear test structure",
"Mock external dependencies (APIs, databases) to ensure fast, reliable tests"
],
"anti_patterns": [
"Do not use production database for tests - use in-memory or test database",
"Do not make real external API calls in tests - always mock them",
"Do not write tests that depend on execution order - ensure independence"
],
"faq": [
{
"question": "What testing frameworks does this skill support?",
"answer": "The skill supports Jest, Pytest, Mocha/Chai, JUnit, and TestClient from various frameworks like Express, Django, FastAPI, and Spring Boot."
},
{
"question": "Does this skill run the tests?",
"answer": "No, this skill generates test code. You need to run the tests yourself using the test framework commands."
},
{
"question": "How do I set up a test database?",
"answer": "Use in-memory databases like sqlite for tests, or create a separate test database. Never use production data for testing."
},
{
"question": "How do I mock external APIs?",
"answer": "Use framework-specific mocking: jest.mock for Jest, unittest.mock for Pytest, or libraries like nock for HTTP mocking."
},
{
"question": "What is the recommended test coverage?",
"answer": "Aim for 80% coverage as a minimum. Configure coverage thresholds in your test framework config file."
},
{
"question": "Can this skill help with TDD?",
"answer": "Yes, the skill includes guidance on Test-Driven Development and can generate tests before implementation code."
}
]
},
"file_structure": [
{
"name": "SKILL.md",
"type": "file",
"path": "SKILL.md",
"lines": 845
},
{
"name": "SKILL.toon",
"type": "file",
"path": "SKILL.toon",
"lines": 16
}
]
}
N:backend-testing
D:Write comprehensive backend tests including unit tests, integration tests, and API tests. Use whe...
G:testing backend unit-test integration-test API-test
U[5]:
**Developing new features**: Write tests first using Test-Driven Development (TDD)
**Adding API endpoints**: Test success/failure cases of REST APIs
**Bug fixing**: Add tests to prevent regressions
**Before refactoring**: Write tests to ensure existing behavior
**CI/CD setup**: Build an automated testing pipeline
S[5]{n,action}:
1,Set up test environment
2,Write Unit Tests (business logic)
3,Integration Test (API endpoints)
4,Authentication/Authorization testing
5,Mocking and test isolation
Related skills
FAQ
Which test tools are supported?
Jest, Pytest and Mocha/Chai, with frameworks like Express, Django, FastAPI and Spring Boot.
What is the default coverage target?
80% coverage by default, configurable to higher targets like 90%.