#!/usr/bin/env python3 """ Simple wrapper script to run DTS API tests with common configurations. """ import sys import os from dts_api_test_suite import DTSAPITester, TestConfig def run_basic_test(): """Run basic DTS test with default settings""" print("šŸš€ Running Basic DTS API Test") print("=" * 50) # Create tester with default configuration tester = DTSAPITester() # Run the test success = tester.run_test() if success: print("\nāœ… Test completed successfully!") return 0 else: print("\nāŒ Test failed!") return 1 def run_verbose_test(): """Run DTS test with verbose output and CSV export""" print("šŸš€ Running Verbose DTS API Test") print("=" * 50) # Create custom configuration config = TestConfig() config.CONSOLE_VERBOSITY = "DEBUG" config.CSV_EXPORT_ENABLED = True config.POLLING_INTERVAL = 0.5 # More frequent polling # Create tester tester = DTSAPITester(config=config) # Run the test success = tester.run_test() if success: print("\nāœ… Verbose test completed successfully!") return 0 else: print("\nāŒ Verbose test failed!") return 1 def run_custom_endpoint_test(api_url): """Run DTS test against custom API endpoint""" print(f"šŸš€ Running DTS API Test against {api_url}") print("=" * 50) # Create tester with custom endpoint tester = DTSAPITester(api_base_url=api_url) # Run the test success = tester.run_test() if success: print(f"\nāœ… Test against {api_url} completed successfully!") return 0 else: print(f"\nāŒ Test against {api_url} failed!") return 1 def main(): """Main entry point with simple command handling""" if len(sys.argv) < 2: print("Usage:") print(" python run_dts_test.py basic # Run basic test") print(" python run_dts_test.py verbose # Run verbose test with CSV export") print(" python run_dts_test.py custom # Run test against custom API endpoint") print("") print("Examples:") print(" python run_dts_test.py basic") print(" python run_dts_test.py verbose") print(" python run_dts_test.py custom http://192.168.1.100:5000/api") return 1 command = sys.argv[1].lower() if command == "basic": return run_basic_test() elif command == "verbose": return run_verbose_test() elif command == "custom": if len(sys.argv) < 3: print("āŒ Error: Custom command requires API URL") print("Usage: python run_dts_test.py custom ") return 1 api_url = sys.argv[2] return run_custom_endpoint_test(api_url) else: print(f"āŒ Error: Unknown command '{command}'") print("Available commands: basic, verbose, custom") return 1 if __name__ == "__main__": sys.exit(main())