Create comprehensive test suites for Frappe Framework v15 applications. Triggers: "create tests", "add tests", "frappe test", "write tests", "test coverage", "/frappe-test". Generates unit tests, integration tests, fixtures, and factory patterns following testing best practices.
View on GitHubFebruary 2, 2026
Select agents to install to:
npx add-skill https://github.com/sergio-bershadsky/ai/blob/main/plugins/frappe-dev/skills/frappe-test/SKILL.md -a claude-code --skill frappe-testInstallation paths:
.claude/skills/frappe-test/# Frappe Testing Suite
Create comprehensive test coverage for Frappe v15 applications using pytest-compatible test classes, fixtures, and factory patterns.
## When to Use
- Adding test coverage to existing code
- Creating tests for new DocTypes/APIs/Services
- Setting up test fixtures and factories
- Writing integration tests with database access
- Creating unit tests without database dependency
## Arguments
```
/frappe-test <target> [--type <unit|integration|e2e>] [--coverage]
```
**Examples:**
```
/frappe-test SalesOrder
/frappe-test inventory_service --type unit
/frappe-test api.orders --type integration --coverage
```
## Procedure
### Step 1: Analyze Test Target
Identify what needs to be tested:
1. **DocType** — Controller lifecycle hooks, validation, business rules
2. **Service** — Business logic, orchestration, error handling
3. **Repository** — Data access patterns, queries
4. **API** — Endpoints, authentication, input validation
5. **Utility** — Helper functions, formatters
### Step 2: Determine Test Strategy
Based on target, determine appropriate test types:
| Component | Unit Test | Integration Test | E2E Test |
|-----------|-----------|------------------|----------|
| DocType Controller | ✓ (hooks) | ✓ (full lifecycle) | — |
| Service Layer | ✓ (logic) | ✓ (with DB) | — |
| Repository | — | ✓ (queries) | — |
| API Endpoint | ✓ (validation) | ✓ (full request) | ✓ |
| Utility Functions | ✓ | — | — |
### Step 3: Generate Test Structure
Create test directory structure:
```
<app>/tests/
├── __init__.py
├── conftest.py # Pytest fixtures
├── factories/ # Test data factories
│ ├── __init__.py
│ └── <doctype>_factory.py
├── unit/ # Unit tests (no DB)
│ ├── __init__.py
│ └── test_<module>.py
├── integration/ # Integration tests (with DB)
│ ├── __init__.py
│ └── test_<module>.py
└── e2e/ # End-to-end tests
└── test_workflows.py
```
### Step 4: Generate conftest.py (Pytest