code-strom / run_tests.py
suryateja008's picture
Initial Commit
7466735 verified
"""
Quick Test - Run all basic tests at once
"""
import subprocess
import sys
def run_test(name, command):
"""Run a test and display results"""
print("\n" + "=" * 70)
print(f"πŸ§ͺ TEST: {name}")
print("=" * 70)
try:
result = subprocess.run(
command,
shell=True,
capture_output=True,
text=True,
timeout=30
)
print(result.stdout)
if result.stderr:
print("STDERR:", result.stderr)
return result.returncode == 0
except subprocess.TimeoutExpired:
print("❌ Test timed out")
return False
except Exception as e:
print(f"❌ Error: {e}")
return False
def main():
print("""
╔══════════════════════════════════════════════════════════════╗
β•‘ SMART PARKING SYSTEM - QUICK TEST SUITE β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
""")
tests = [
("Database Slot Check", "python check_slots.py"),
("Full Database Integration", "python test_database.py"),
]
results = {}
for name, command in tests:
results[name] = run_test(name, command)
# Summary
print("\n" + "=" * 70)
print("πŸ“Š TEST SUMMARY")
print("=" * 70)
for name, passed in results.items():
status = "βœ… PASSED" if passed else "❌ FAILED"
print(f"{status}: {name}")
total = len(results)
passed = sum(1 for v in results.values() if v)
print(f"\n Total: {passed}/{total} tests passed")
if passed == total:
print("\nπŸŽ‰ All tests passed!")
else:
print("\n⚠️ Some tests failed. Check the output above.")
print("\nπŸ’‘ To start the API server, run:")
print(" python backend/main.py")
print("\nπŸ’‘ Then visit http://127.0.0.1:8000/docs for interactive API testing")
if __name__ == "__main__":
main()