Files
AI-Trader/scripts
Bill f8da19f9b3 test: add end-to-end test for complete simulation workflow
- Created comprehensive E2E test in tests/e2e/test_full_simulation_workflow.py
- Tests new trading_days schema with manually populated data
- Verifies database helper methods work correctly
- Tests Results API structure and filtering
- Validates holdings chain across multiple days
- Checks daily P&L calculation and storage
- Verifies reasoning summary/full retrieval
- Fixed database index creation for backward compatibility with old schema
- Added migration script for cleaning old positions table
- Test uses dependency override to ensure API uses correct database

NOTE: Test does not run full simulation since model_day_executor
has not yet been migrated to new schema. Instead directly populates
trading_days table and validates API layer works correctly.

Test verifies Task 9 requirements from implementation plan.
2025-11-04 07:30:18 -05:00
..

AI-Trader Scripts

This directory contains standardized scripts for testing, validation, and operations.

Testing Scripts

Interactive Testing

test.sh - Interactive test menu

bash scripts/test.sh

User-friendly menu for all testing operations. Best for local development.

Development Testing

quick_test.sh - Fast unit test feedback

bash scripts/quick_test.sh
  • Runs unit tests only
  • No coverage
  • Fails fast
  • ~10-30 seconds

run_tests.sh - Full test suite

bash scripts/run_tests.sh [OPTIONS]
  • All test types (unit, integration, e2e)
  • Coverage reporting
  • Parallel execution support
  • Highly configurable

coverage_report.sh - Coverage analysis

bash scripts/coverage_report.sh [OPTIONS]
  • Generate HTML/JSON/terminal reports
  • Check coverage thresholds
  • Open reports in browser

CI/CD Testing

ci_test.sh - CI-optimized testing

bash scripts/ci_test.sh [OPTIONS]
  • JUnit XML output
  • Coverage XML for CI tools
  • Environment variable configuration
  • Excludes Docker tests

Validation Scripts

validate_docker_build.sh - Docker build validation

bash scripts/validate_docker_build.sh

Validates Docker setup, build, and container startup.

test_api_endpoints.sh - API endpoint testing

bash scripts/test_api_endpoints.sh

Tests all REST API endpoints with real simulations.

Other Scripts

migrate_price_data.py - Data migration utility

python scripts/migrate_price_data.py

Migrates price data between formats.

Quick Reference

Task Script Command
Quick test quick_test.sh bash scripts/quick_test.sh
Full test run_tests.sh bash scripts/run_tests.sh
Coverage coverage_report.sh bash scripts/coverage_report.sh -o
CI test ci_test.sh bash scripts/ci_test.sh -f
Interactive test.sh bash scripts/test.sh
Docker validation validate_docker_build.sh bash scripts/validate_docker_build.sh
API testing test_api_endpoints.sh bash scripts/test_api_endpoints.sh

Common Options

Most test scripts support:

  • -h, --help - Show help
  • -v, --verbose - Verbose output
  • -f, --fail-fast - Stop on first failure
  • -t, --type TYPE - Test type (unit, integration, e2e, all)
  • -m, --markers MARKERS - Pytest markers
  • -p, --parallel - Parallel execution

Documentation

For detailed usage, see:

Making Scripts Executable

If scripts are not executable:

chmod +x scripts/*.sh