frappe-unit-test-generator_skill

This skill generates production-ready unit tests for Frappe DocTypes, controllers, and APIs to accelerate test coverage and reliability.

7

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill venkateshvenki404224/frappe-apps-manager --skill frappe-unit-test-generator

  • SKILL.md19.9 KB

Overview

This skill generates production-ready unit tests for Frappe DocTypes, controllers, and whitelisted API methods following patterns used in ERPNext and Frappe core. It produces complete test files, helper fixtures, and focused test cases for validations, calculations, workflows, permissions, database queries, child tables, and API behavior. Use it to accelerate test coverage and enforce predictable app behavior.

How this skill works

Given a DocType, controller method, or API function description, the skill builds a FrappeTestCase class with setUp/tearDown or class-level fixtures, helper creation methods, and multiple test methods that assert expected outcomes. It follows common ERPNext patterns: creating docs, asserting exceptions, verifying calculations, testing docstatus transitions, permission scenarios, and raw DB queries. The output is ready-to-save Python test files using the frappe unittest utilities.

When to use it

  • Creating new unit test files for DocTypes or controllers
  • Writing tests for API endpoints or whitelisted methods
  • Validating business logic, calculations, and workflows
  • Setting up reusable test fixtures or test data
  • Testing permissions, roles, and access control

Best practices

  • Use FrappeTestCase and class fixtures for shared data to speed up tests
  • Isolate tests by rolling back DB changes in tearDown or using fixtures
  • Assert both success paths and expected ValidationError/PermissionError failures
  • Document expected behavior for edge cases (duplicates, negative values)
  • Prefer small, focused tests: one assertion intent per test method

Example use cases

  • Generate tests for an Item DocType including creation, existence checks, and helper factory
  • Create tests for Sales Invoice: posting date validation, quantity rules, totals, and taxes
  • Build workflow tests for Stock Entry: submit, cancel, amend and docstatus assertions
  • Produce permission tests that validate read/write/create/denied access for users with roles
  • Generate API tests for whitelisted functions including auth, input validation, and filtered results

FAQ

No. Tests use the Frappe test patterns that isolate changes and typically rollback database changes in tearDown; use a test site or CI environment.

Can this generate fixtures for multiple tests?

Yes. It creates setUpClass/tearDownClass patterns and reusable helper methods to create shared test data efficiently.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational