DroneAgent / chat_testing /run_tests.py
zok213
Initial commit
8579cdc
#!/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()