testing

Write and run unit, integration, and Cypress UI tests for Frappe applications.

62|23|Updated Feb 7, 2026
One-click install
npx skills add https://github.com/lubusIN/frappe-skills --skill testing-lubusin
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: testing
Source: https://github.com/lubusIN/frappe-skills/tree/main/testing
Command: npx skills add https://github.com/lubusIN/frappe-skills --skill testing-lubusin

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Frappe apps often ship without adequate test coverage, leading to regressions, permission bugs, and broken workflows discovered only in production. This Skill provides structured guidance for writing and running unit, integration, and UI tests using Frappe's built-in testing framework. ## Core Features & Use Cases - DocType and API Testing: Write unit tests with FrappeTestCase, test validation errors, permissions, and whitelisted API methods with proper setup and teardown. - UI Testing with Cypress: Run end-to-end Desk interface tests via bench run-ui-tests with custom Cypress commands for form filling and list operations. - CI Pipeline Setup: Configure GitHub Actions, GitLab CI, or CircleCI workflows with MariaDB/Redis services, coverage reporting, and test matrices. - Use Case: You added a new DocType controller with validation logic. Use this Skill to generate a test class covering creation, validation failures, and role-based permission checks, then run it with bench --site test_site run-tests --doctype "My DocType". ## Quick Start Write unit tests for my Frappe app's Sales Order DocType covering validation and permission checks, then show me how to run them with bench.

Frequently Asked Questions about testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run tests for a Frappe app?▼

Run tests with `bench --site <site> run-tests --app my_app`. You can narrow scope with `--module` for a specific module or `--doctype` for a single DocType, and add `-v` for verbose output.

How do I write unit tests for a Frappe DocType?▼

Create a `test_<doctype_name>.py` file alongside the DocType and extend `frappe.tests.utils.FrappeTestCase`. Use `frappe.get_doc` to build test documents in setUp, assert validation errors with `assertRaises`, and delete created records in tearDown.

How do I test permissions in Frappe?▼

Use `frappe.set_user()` to switch to a restricted user context, then assert that unauthorized actions raise `frappe.PermissionError`. Always reset to Administrator in a finally block or tearDown to avoid polluting other tests.

Does Frappe support UI testing with Cypress?▼

Yes, Frappe supports Cypress for end-to-end UI testing. Run tests with `bench --site <site> run-ui-tests my_app` or add `--headless` for CI environments. Custom commands like `fill_field` and `login` simplify Desk interactions.

Why are my Frappe tests flaky or failing intermittently?▼

Flaky tests usually come from missing cleanup, shared state between tests, or hardcoded record names that collide. Use unique names with random suffixes, roll back transactions in tearDown, and keep each test independent of execution order.

How do I set up CI testing for a Frappe app on GitHub Actions?▼

Create a workflow with MariaDB and Redis services, install frappe-bench, initialize a bench, create a test site, install your app, and run `bench --site test_site run-tests --app my_app --coverage`. Cache pip and npm dependencies to speed up builds.