frappe-run-tests
Frappe Test Runner
Run all commands from the bench directory (/workspace/development/frappe-bench).
Omit --site — the default site is used automatically. If you get Site not found or Tests not allowed, run:
bench set-config default-site development.localhost
bench set-config allow_tests true
Decision Tree
What does the user want to test?
A specific test file (most common)
Derive the --module value from the file path:
File path: apps/{app}/{app}/{module}/doctype/{doctype}/test_{doctype}.py
Module arg: {app}.{module}.doctype.{doctype}.test_{doctype}
Examples:
| File path | --module value |
|---|---|
apps/soldamundo/soldamundo/soldamundo/doctype/item/test_item.py |
soldamundo.soldamundo.doctype.item.test_item |
apps/tweaks/tweaks/tweaks/doctype/ac_rule/test_ac_rule.py |
tweaks.tweaks.doctype.ac_rule.test_ac_rule |
apps/erpnext/erpnext/stock/doctype/item/test_item.py |
erpnext.stock.doctype.item.test_item |
apps/soldamundo/soldamundo/utils/tests/test_helpers.py |
soldamundo.utils.tests.test_helpers |
Formula: Strip apps/{app}/ prefix, strip .py suffix, replace / with .
bench run-tests --module {module_path}
Add --failfast to stop on first failure (recommended during iteration):
bench run-tests --module {module_path} --failfast
Add --skip-test-records to skip creating test records (useful when test records are large or complex and not needed for the specific test being run):
bench run-tests --module {module_path} --skip-test-records
Multiple test modules
⚠️ --module only accepts one value. Passing --module A --module B silently runs only the last module. Do not repeat the flag.
Use a shell for loop to run them sequentially and collect per-module results:
for module in \
soldamundo.sales_performance.doctype.sales_performance_period.test_sales_performance_period \
soldamundo.sales_performance.doctype.sales_commission_policy.test_sales_commission_policy \
soldamundo.sales_performance.doctype.sales_commission_rule.test_sales_commission_rule; do
echo "=== $module ==="
bench run-tests --module "$module" 2>&1 | grep -E "(Ran [0-9]+ test|OK|FAILED|ERROR)" | tail -3
done
Omit the grep pipe to see full verbose output per module.
A specific doctype
bench run-tests --doctype "{Doctype Name}"
Uses the DocType's display name (spaces, title case). Frappe discovers the test file automatically.
# Examples
bench run-tests --doctype "Sales Invoice"
bench run-tests --doctype "AC Rule"
bench run-tests --doctype "Item"
All tests for an app
bench run-tests --app {app_name}
# Examples
bench run-tests --app soldamundo
bench run-tests --app tweaks
bench run-tests --app erpnext
Deriving module path from current file
When the user says "run this test" or "run tests for this file", derive the module path from the file the user has open:
- Get the absolute file path (e.g.
/workspace/development/frappe-bench/apps/soldamundo/soldamundo/utils/tests/test_helpers.py) - Strip everything up to and including
apps/{app_name}/(result:soldamundo/utils/tests/test_helpers.py) - Strip
.pysuffix (result:soldamundo/utils/tests/test_helpers) - Replace
/with.(result:soldamundo.utils.tests.test_helpers) - Use as:
bench run-tests --module soldamundo.utils.tests.test_helpers
If the file is not a test file (no test_ prefix), look for a corresponding test_ file in the same directory or the doctype's directory.
More from kehwar/skills
to-prd
Turn the current conversation context into a PRD and publish it to Beads Issue Tracker. Use when user wants to create a PRD from the current context.
11setup-workflow-skills
Sets up an `## Agent orientation` block in AGENTS.md/CLAUDE.md so the engineering skills know this repo uses Beads for issue tracking. Run before first use of `to-tasks`, `to-prd`, `tdd`, `improve-codebase-architecture`, or `zoom-out`.
11tdd
Test-driven development with red-green-refactor loop. Use when user wants to build features or fix bugs using TDD, mentions "red-green-refactor", wants integration tests, or asks for test-first development. Tracks progress in Beads Issue Tracker.
10write-a-skill
Create new agent skills with proper structure, progressive disclosure, and bundled resources. Use when user wants to create, write, or build a new skill.
9to-tasks
Break a plan, spec, or PRD into independently-grabbable tasks/issues on Beads Issue Tracker using tracer-bullet vertical slices. Use when user wants to convert a plan into tasks, create implementation tickets, or break down work into tasks.
9grill-me
Interview the user relentlessly about a plan or design until reaching shared understanding, resolving each branch of the decision tree. Use when user wants to stress-test a plan, get grilled on their design, or mentions "grill me".
8