seitime-frappe/frappe/testing
David Arnold 4000cba810
fix: compat FrappeTestCase (#28367)
due to circular imports issues and me going out of my way to make it work 'cleanly', the previous backwards compatibility for FrappeTestCase unfortunately did not work on the manual cli test runner 'run-tests'

While not generally not affecting CI (which is precedented by the framwork's best practices to use 'run-parallel-test'), this broke some manual developer workflows

The restauration of FrappeTestCase in these scenario now unfortunately involves a plain copy of almost an entire implementation into the dumpster.

On the one hand, this doesn not accurately reflect the rather minuscule differences between IntegrationTestCase and FrappeTestCase, but on the other hand, it shields and freezes the old api should IntegrationTestCase evolve futher
2024-11-05 18:16:22 +01:00
..
__init__.py Testing Module (#28000) 2024-10-07 09:46:49 +02:00
config.py feat: better test & dumpster output (#28044) 2024-10-09 12:05:19 +02:00
discovery.py fix: compat FrappeTestCase (#28367) 2024-11-05 18:16:22 +01:00
environment.py fix: Testing Module 28000 (#28032) 2024-10-08 10:14:19 +00:00
README.md Testing Module (#28000) 2024-10-07 09:46:49 +02:00
result.py fix(testing): pdb post mortem (#28156) 2024-10-17 18:52:25 +00:00
runner.py fix(testing): pdb post mortem (#28156) 2024-10-17 18:52:25 +00:00
utils.py Testing Module (#28000) 2024-10-07 09:46:49 +02:00

Frappe Testing Module

This module provides a comprehensive framework for running tests in Frappe applications. It includes functionality for test discovery, execution, result reporting, and environment setup.

Key Components

  • TestConfig: Configuration class for customizing test execution
  • TestRunner: Main class for running test suites with additional Frappe-specific functionality
  • TestResult: Custom test result class for improved output formatting and logging
  • discover_all_tests: Function to discover all tests in specified Frappe apps
  • discover_doctype_tests: Function to discover tests for specific DocTypes
  • discover_module_tests: Function to discover tests in specific modules

Usage

This module is typically used by Frappe's CLI commands for running tests, but can also be used programmatically for custom test execution scenarios.

For detailed information about each component, please refer to the well-commented code in the following files:

Example

from frappe.testing import TestConfig, TestRunner, discover_all_tests

config = TestConfig(failfast=True, verbose=2)
runner = TestRunner(cfg=config)
discover_all_tests(['my_app'], runner)
runner.run()

For more detailed information about each component and its functionality, please refer to the docstrings and comments in the respective files.