frappe-testlisted
Install: claude install-skill prilk-consulting/frappe-agent-kit
# Testing Frappe Apps
## Usage
Use this skill when:
- Writing unit/integration tests for DocTypes, controllers, or whitelisted methods
- Choosing test base classes and fixtures (test records, dependencies)
- Debugging test isolation problems (leaked records, permission state, naming collisions)
- Setting up `bench run-tests` locally or in CI
## One-time site setup
Tests refuse to run until the site allows them:
```bash
bench --site <site> set-config allow_tests true
```
(CI bypass: when the `CI` environment variable is set, this check is skipped.)
Use a dedicated dev/test site, never a site with data you care about — `before_tests` hooks (ERPNext's wipes and re-runs the setup wizard on some versions) and test records write real rows.
## Running tests
```bash
bench --site <site> run-tests --app myapp # whole app
bench --site <site> run-tests --doctype "Sales Invoice" # one doctype's tests
bench --site <site> run-tests --module myapp.mymodule.doctype.thing.test_thing
bench --site <site> run-tests --module ...test_thing --case TestThing
bench --site <site> run-tests --module ...test_thing --test test_validation_fails
bench --site <site> run-tests --app myapp --failfast # stop on first failure
bench --site <site> run-tests --app myapp --coverage # coverage report
```
(Don't use `--skip-test-records` — deprecated; on v16 it exits without running any tests.)
## Writing tests
Test file lives next to the doctype: `doctype/<name>/test_<name