flowCreate.solutions

Testing Overview

This document outlines the testing philosophy, configuration, and requirements for backend applications.

Philosophy

The backend uses pytest with async support for comprehensive test coverage across all modules. Tests should be isolated, reliable, and mirror the application structure.

Configuration

pytest.ini

[pytest]
asyncio_mode = strict
asyncio_default_fixture_loop_scope = function
testpaths = tests

Environment

Tests must run in an environment configuration that is explicitly test-friendly:

  • Rate limiting disabled (the reference backend disables the limiter when ENVIRONMENT is local or test, or when DISABLE_RATE_LIMITER=1).
  • Database configured for safe execution (the reference backend uses the normal async session factory; suites document constraints like avoiding parallel runs against the same database when isolation is not guaranteed).

Running Tests

Run All Tests

pytest

Run Specific Module

pytest tests/users/

Run Specific Test File

pytest tests/companies/test_company_creation.py

Run with Coverage

pytest --cov=. --cov-report=html

Note: coverage requires pytest-cov installed (the reference backend installs it as a development dependency).

Scheduled Test Suite

The reference backend includes an optional scheduled test-suite worker gated by ENABLE_TEST_SUITE_WORKER that runs pytest periodically in the development environment, writes a JUnit XML report, and can notify on failures.

If you enable a scheduled suite:

  • Ensure it runs with rate limiting disabled and other workers/side effects gated off as needed for reliability.
  • Prefer emitting machine-readable output (e.g. --junitxml=...) for reporting.