testing-patterns

Installation
SKILL.md

Frappe Testing Patterns

Reference for writing maintainable tests in Frappe v14+. Focused on the patterns that hold up as your test suite grows past a few dozen tests — factory functions, fixture isolation, mocking, and the anti-patterns that cause flaky failures in CI.

Which base class

from frappe.tests.utils import FrappeTestCase

Use FrappeTestCase (not unittest.TestCase) for anything that touches Frappe — controllers, APIs, DB. It handles:

  • Per-test transaction rollback (you don't need to clean up created docs in tearDown)
  • frappe.flags.in_test = True (so production code can branch on test mode if needed)
  • Test record loading from test_records.json
  • Permission isolation (resets frappe.session.user between tests)

Use plain unittest.TestCase only for pure-Python helpers with no Frappe touchpoints (string utilities, math, etc.).

File location and naming

Installs
6
GitHub Stars
21
First Seen
May 15, 2026
testing-patterns — unityappsuite/frappe-claude