openrag/TESTING_QUICKSTART.md
Edwin Jose 3881c50ad5 Add comprehensive test suite and Makefile targets
Introduces a full test suite under the tests/ directory, including API, service, connector, and utility tests, along with fixtures and documentation. Expands Makefile with granular test commands for unit, integration, API, service, connector, coverage, and quick tests. Adds configuration files for pytest and coverage reporting, and provides a quickstart guide for testing workflow.
2025-10-07 04:41:52 -04:00

1.4 KiB

Testing Quick Start Guide

Run Tests

# All unit tests (fastest - recommended for development)
make test-unit

# All tests
make test

# With coverage report
make test-coverage
open htmlcov/index.html

# Specific category
make test-api
make test-service
make test-utils

# Verbose output
make test-verbose

# Re-run only failed tests
make test-failed

Test Structure

tests/
├── api/          - API endpoint tests
├── services/     - Business logic tests
├── utils/        - Utility function tests
├── connectors/   - Connector tests
├── config/       - Configuration tests
└── fixtures/     - Reusable test fixtures

Current Status

77 passing unit tests ~2 second runtime No mocks - using real fixtures Ready for CI/CD

Quick Commands

Command Description
make test-unit Fast unit tests
make test-integration Tests requiring OpenSearch/Langflow
make test-coverage Generate coverage report
make test-api API tests only
make test-service Service tests only
make test-quick Quick unit tests, no coverage

Adding New Tests

  1. Create file: tests/category/test_feature.py
  2. Use markers: @pytest.mark.unit or @pytest.mark.integration
  3. Use fixtures from conftest.py
  4. Run: make test-unit

See tests/README.md for detailed documentation.