File size: 2,246 Bytes
8579cdc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/env python3
"""
Test Runner for DroneAgent Testing Suite
"""
import asyncio
import sys
import os
import subprocess
import time

# Add parent directory to path to import modules
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

from comprehensive_test_suite import DroneAgentTester
from full_chat_conversation_test import ChatConversationTester

async def check_server_health():
    """Check if DroneAgent server is running."""
    import aiohttp
    
    try:
        async with aiohttp.ClientSession() as session:
            async with session.get("http://localhost:8000/") as response:
                if response.status == 200:
                    data = await response.json()
                    if data.get("status") == "operational":
                        print("✅ DroneAgent server is running and operational")
                        return True
    except Exception as e:
        print(f"❌ Server not accessible: {str(e)}")
    
    return False

async def run_all_tests():
    """Run all test suites."""
    print("🚀 DroneAgent Testing Suite")
    print("=" * 60)
    print(f"Started at: {time.strftime('%Y-%m-%d %H:%M:%S')}")
    
    # Check server health
    if not await check_server_health():
        print("\n❌ Please start the DroneAgent server first:")
        print("   python3 main.py")
        return False
    
    print("\n🧪 Running Comprehensive Test Suite...")
    tester = DroneAgentTester()
    await tester.run_all_tests()
    
    print("\n💬 Running Chat Conversation Tests...")
    chat_tester = ChatConversationTester()
    await chat_tester.run_conversation_tests()
    
    print("\n🎉 All tests completed!")
    return True

def main():
    """Main test runner."""
    try:
        success = asyncio.run(run_all_tests())
        if success:
            print("\n✅ Testing completed successfully")
            sys.exit(0)
        else:
            print("\n❌ Testing failed")
            sys.exit(1)
    except KeyboardInterrupt:
        print("\n⚠️ Testing interrupted by user")
        sys.exit(1)
    except Exception as e:
        print(f"\n❌ Testing failed with error: {str(e)}")
        sys.exit(1)

if __name__ == "__main__":
    main()