100+ copy-paste UI components in plain HTML and CSS: no dependencies, no build step.

0 downloads

dbbasic-web-native/test_all.py
Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/dbbasic-web-native.git
HTTPS
https://gitstable.com/git/askrobots/dbbasic-web-native.git
SSH
ssh://git@gitstable.com:2222/askrobots/dbbasic-web-native.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

danq9 Add canonical.html v1.0 - The single source of truth for usability standards fb6e650 1 year ago History
test_all.py · 5.0 KB · 159 lines
1#!/usr/bin/env python3
2"""
3Unified test runner for semantic components.
4Runs tests in optimal order: fast → medium → slow (expensive).
5
6Usage:
7 python3 test_all.py # Run all tests (except spatial)
8 python3 test_all.py --fast # Only tier 1 free tests
9 python3 test_all.py --skip-vision # Skip expensive vision tests
10 python3 test_all.py --spatial # Include AR/VR spatial tests
11"""
12
13import subprocess
14import sys
15import time
16from pathlib import Path
17
18class TestRunner:
19 def __init__(self, args):
20 self.args = args
21 self.results = {}
22
23 def run_test(self, name, command, cost_label):
24 """Run a test suite and capture results"""
25 print(f"\n{'='*60}")
26 print(f"🧪 {name} ({cost_label})")
27 print(f"{'='*60}\n")
28
29 start_time = time.time()
30 result = subprocess.run(command, shell=True)
31 elapsed = time.time() - start_time
32
33 self.results[name] = {
34 'passed': result.returncode == 0,
35 'elapsed': elapsed,
36 'cost': cost_label
37 }
38
39 return result.returncode == 0
40
41 def run_all(self):
42 """Run all test suites in optimal order"""
43 all_passed = True
44
45 # Tier 1: Free tests (always run)
46 print("\n🏃 TIER 1: FREE TESTS (DOM validation)")
47 if not self.run_test(
48 "Structural Tests",
49 "python3 test_structure.py",
50 "FREE"
51 ):
52 all_passed = False
53
54 if not self.run_test(
55 "Integration Tests",
56 "python3 test_integration.py",
57 "FREE"
58 ):
59 all_passed = False
60
61 # Tier 2: Cheap tests (if not --fast-only)
62 if '--fast' not in sys.argv:
63 print("\n🏃 TIER 2: CHEAP TESTS (Text AI + Context)")
64 if not self.run_test(
65 "Voice Command Tests",
66 "python3 test_voice.py",
67 "~$0.01"
68 ):
69 all_passed = False
70
71 if not self.run_test(
72 "Context Tests (Mobile/Tablet/Desktop)",
73 "python3 test_context.py",
74 "FREE"
75 ):
76 all_passed = False
77
78 if not self.run_test(
79 "Gesture Tests",
80 "python3 test_gestures.py",
81 "FREE"
82 ):
83 all_passed = False
84
85 if not self.run_test(
86 "Attention Budget Tests",
87 "python3 test_attention.py",
88 "FREE"
89 ):
90 all_passed = False
91
92 if not self.run_test(
93 "Performance Tests",
94 "python3 test_performance.py",
95 "FREE"
96 ):
97 all_passed = False
98
99 # Tier 3: Expensive tests (if not --skip-vision)
100 if '--skip-vision' not in sys.argv and '--fast' not in sys.argv:
101 print("\n🏃 TIER 3: EXPENSIVE TESTS (Vision AI)")
102 if not self.run_test(
103 "Visual Accessibility Tests",
104 "python3 test_visual_ai.py",
105 "~$0.50"
106 ):
107 all_passed = False
108
109 # Tier 4: Future tests (if --spatial flag)
110 if '--spatial' in sys.argv:
111 print("\n🏃 TIER 4: FUTURE TESTS (AR/VR Spatial)")
112 if not self.run_test(
113 "Spatial Context Tests (AR/VR)",
114 "python3 test_spatial.py",
115 "FREE"
116 ):
117 all_passed = False
118
119 # Print summary
120 self.print_summary()
121
122 return all_passed
123
124 def print_summary(self):
125 """Print test results summary"""
126 print(f"\n{'='*60}")
127 print("📊 TEST SUMMARY")
128 print(f"{'='*60}\n")
129
130 total_time = sum(r['elapsed'] for r in self.results.values())
131 passed = sum(1 for r in self.results.values() if r['passed'])
132 total = len(self.results)
133
134 for name, result in self.results.items():
135 status = "✅ PASSED" if result['passed'] else "❌ FAILED"
136 print(f"{status} - {name} ({result['elapsed']:.1f}s, {result['cost']})")
137
138 print(f"\n{'='*60}")
139 print(f"Results: {passed}/{total} test suites passed")
140 print(f"Total time: {total_time:.1f}s")
141 print(f"{'='*60}\n")
142
143 # Show where to find detailed results
144 print("📁 Detailed results:")
145 print(" - test-results/results-structure.json")
146 print(" - test-results/results-integration.json")
147 print(" - test-results/results-voice.json")
148 print(" - test-results/results-context.json")
149 print(" - test-results/results-gestures.json")
150 print(" - test-results/results-attention.json")
151 print(" - test-results/results-performance.json")
152 print(" - test-results/results-ai.json")
153 print(" - test-results/results-spatial.json (with --spatial)")
154 print(" - test-results/accessibility-report-ai.html")
155
156if __name__ == '__main__':
157 runner = TestRunner(sys.argv)
158 success = runner.run_all()
159 sys.exit(0 if success else 1)