#!/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()