fetch_ml/docs/src/testing.md
Jeremie Fraeys 69dc9e6af4 Clean up README files and enhance testing documentation
- Remove 14 duplicate README files from test fixtures
- Clean up and restructure docs/src/testing.md with comprehensive testing guide
- Update main README.md to highlight testing and reference docs/ structure
- Remove empty .new files
- Keep only valuable, directory-specific README files (reduced from 34 to 20)
2025-12-06 15:43:51 -05:00

2.8 KiB

Testing Guide

Comprehensive testing documentation for FetchML platform.

Quick Start Testing

For a fast 5-minute testing experience, see the Quick Start Testing Guide.

Test Types

Unit Tests

make test-unit          # Go unit tests only
cd cli && zig build test  # Zig CLI tests

Integration Tests

make test-integration   # API and database integration

End-to-End Tests

make test-e2e          # Full workflow testing

All Tests

make test              # Run complete test suite
make test-coverage     # With coverage report

Docker Testing

Development Environment

docker-compose up -d
make test
docker-compose down

Production Environment Testing

docker-compose -f docker-compose.prod.yml up -d
make test-auth         # Multi-user auth test
make self-cleanup      # Clean up after testing

Performance Testing

Benchmark Suite

./scripts/benchmarks/run-benchmarks-local.sh

Load Testing

make test-load         # API load testing

Authentication Testing

Multi-user authentication testing is fully covered in the Quick Start Testing Guide.

make test-auth         # Quick auth role testing

CLI Testing

Build and Test CLI

cd cli && zig build dev
./cli/zig-out/dev/ml --help
zig build test

CLI Integration Tests

make test-cli          # CLI-specific integration tests

Troubleshooting Tests

Common Issues

  • Server not running: Check with docker ps --filter "name=ml-"
  • Authentication failures: Verify configs in ~/.ml/config-*.toml
  • Connection issues: Test API with curl -I http://localhost:9103/health

Debug Mode

make test-debug        # Run tests with verbose output

Test Configuration

Test Configs Location

  • ~/.ml/config-admin.toml - Admin user
  • ~/.ml/config-researcher.toml - Researcher user
  • ~/.ml/config-analyst.toml - Analyst user

Test Data

  • tests/fixtures/ - Test data and examples
  • tests/benchmarks/ - Performance test data

Continuous Integration

Tests run automatically on:

  • Pull requests (full suite)
  • Main branch commits (unit + integration)
  • Releases (full suite + benchmarks)

Writing Tests

Go Tests

  • Unit tests: *_test.go files
  • Integration tests: tests/e2e/ directory
  • Benchmark tests: tests/benchmarks/ directory

Zig Tests

  • CLI tests: cli/tests/ directory
  • Follow Zig testing conventions

See Also