#!/bin/bash # Run all tests and generate coverage report set -e echo "╔══════════════════════════════════════════════════════════════╗" echo "║ Running All Tests ║" echo "╚══════════════════════════════════════════════════════════════╝" echo "" BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" cd "$BASE_DIR" PASSED=0 FAILED=0 test_component() { local name="$1" local dir="$2" local test_file="$3" echo -n "Testing $name... " if [ -f "$dir/$test_file" ]; then if (cd "$dir" && python3 "$test_file" > /tmp/test_output.txt 2>&1); then echo "✅ PASSED" ((PASSED++)) return 0 else echo "❌ FAILED" tail -3 /tmp/test_output.txt 2>/dev/null || echo " (check output)" ((FAILED++)) return 1 fi else echo "⚠️ SKIPPED (test file not found)" return 2 fi } # Test components that don't require server test_component "Router" "routing" "test_router.py" test_component "Memory System" "memory" "test_memory.py" test_component "Monitoring" "monitoring" "test_monitoring.py" test_component "Safety Boundaries" "safety/boundaries" "test_boundaries.py" test_component "Confirmations" "safety/confirmations" "test_confirmations.py" test_component "Session Manager" "conversation" "test_session.py" test_component "Summarization" "conversation/summarization" "test_summarization.py" test_component "Memory Tools" "mcp-server/tools" "test_memory_tools.py" test_component "Dashboard API" "mcp-server/server" "test_dashboard_api.py" test_component "Admin API" "mcp-server/server" "test_admin_api.py" echo "" echo "╔══════════════════════════════════════════════════════════════╗" echo "║ Test Results ║" echo "╚══════════════════════════════════════════════════════════════╝" echo "✅ Passed: $PASSED" echo "❌ Failed: $FAILED" echo "" if [ $FAILED -eq 0 ]; then echo "🎉 All tests passed!" exit 0 else echo "⚠️ Some tests failed" exit 1 fi