Files
aitbc/tests/testing/run_test_suite.py
aitbc1 bfe6f94b75
Some checks failed
AITBC CI/CD Pipeline / lint-and-test (3.11) (push) Has been cancelled
AITBC CI/CD Pipeline / lint-and-test (3.12) (push) Has been cancelled
AITBC CI/CD Pipeline / lint-and-test (3.13) (push) Has been cancelled
AITBC CI/CD Pipeline / test-cli (push) Has been cancelled
AITBC CI/CD Pipeline / test-services (push) Has been cancelled
AITBC CI/CD Pipeline / test-production-services (push) Has been cancelled
AITBC CI/CD Pipeline / security-scan (push) Has been cancelled
AITBC CI/CD Pipeline / build (push) Has been cancelled
AITBC CI/CD Pipeline / deploy-staging (push) Has been cancelled
AITBC CI/CD Pipeline / deploy-production (push) Has been cancelled
AITBC CI/CD Pipeline / performance-test (push) Has been cancelled
AITBC CI/CD Pipeline / docs (push) Has been cancelled
AITBC CI/CD Pipeline / release (push) Has been cancelled
AITBC CI/CD Pipeline / notify (push) Has been cancelled
Security Scanning / Bandit Security Scan (apps/coordinator-api/src) (push) Has been cancelled
Security Scanning / Bandit Security Scan (cli/aitbc_cli) (push) Has been cancelled
Security Scanning / Bandit Security Scan (packages/py/aitbc-core/src) (push) Has been cancelled
Security Scanning / Bandit Security Scan (packages/py/aitbc-crypto/src) (push) Has been cancelled
Security Scanning / Bandit Security Scan (packages/py/aitbc-sdk/src) (push) Has been cancelled
Security Scanning / Bandit Security Scan (tests) (push) Has been cancelled
Security Scanning / CodeQL Security Analysis (javascript) (push) Has been cancelled
Security Scanning / CodeQL Security Analysis (python) (push) Has been cancelled
Security Scanning / Dependency Security Scan (push) Has been cancelled
Security Scanning / Container Security Scan (push) Has been cancelled
Security Scanning / OSSF Scorecard (push) Has been cancelled
Security Scanning / Security Summary Report (push) Has been cancelled
AITBC CLI Level 1 Commands Test / test-cli-level1 (3.11) (push) Has been cancelled
AITBC CLI Level 1 Commands Test / test-cli-level1 (3.12) (push) Has been cancelled
AITBC CLI Level 1 Commands Test / test-cli-level1 (3.13) (push) Has been cancelled
AITBC CLI Level 1 Commands Test / test-summary (push) Has been cancelled
chore: remove outdated documentation and reference files
- Remove debugging service documentation (DEBUgging_SERVICES.md)
- Remove development logs policy and quick reference guides
- Remove E2E test creation summary
- Remove gift certificate example file
- Remove GitHub pull summary documentation
2026-03-25 12:56:07 +01:00

147 lines
3.8 KiB
Python
Executable File

#!/usr/bin/env python3
"""
Test suite runner for AITBC
"""
import sys
import argparse
import subprocess
from pathlib import Path
def run_command(cmd, description):
"""Run a command and handle errors"""
print(f"\n{'='*60}")
print(f"Running: {description}")
print(f"Command: {' '.join(cmd)}")
print('='*60)
result = subprocess.run(cmd, capture_output=True, text=True)
if result.stdout:
print(result.stdout)
if result.stderr:
print("STDERR:", result.stderr)
return result.returncode == 0
def main():
parser = argparse.ArgumentParser(description="AITBC Test Suite Runner")
parser.add_argument(
"--suite",
choices=["unit", "integration", "e2e", "security", "all"],
default="all",
help="Test suite to run"
)
parser.add_argument(
"--coverage",
action="store_true",
help="Generate coverage report"
)
parser.add_argument(
"--parallel",
action="store_true",
help="Run tests in parallel"
)
parser.add_argument(
"--verbose",
action="store_true",
help="Verbose output"
)
parser.add_argument(
"--marker",
help="Run tests with specific marker (e.g., unit, integration)"
)
parser.add_argument(
"--file",
help="Run specific test file"
)
args = parser.parse_args()
# Base pytest command
pytest_cmd = ["python", "-m", "pytest"]
# Add verbosity
if args.verbose:
pytest_cmd.append("-v")
# Add coverage if requested
if args.coverage:
pytest_cmd.extend([
"--cov=apps",
"--cov-report=html:htmlcov",
"--cov-report=term-missing"
])
# Add parallel execution if requested
if args.parallel:
pytest_cmd.extend(["-n", "auto"])
# Determine which tests to run
test_paths = []
if args.file:
test_paths.append(args.file)
elif args.marker:
pytest_cmd.extend(["-m", args.marker])
elif args.suite == "unit":
test_paths.append("tests/unit/")
elif args.suite == "integration":
test_paths.append("tests/integration/")
elif args.suite == "e2e":
test_paths.append("tests/e2e/")
# E2E tests might need additional setup
pytest_cmd.extend(["--driver=Chrome"])
elif args.suite == "security":
pytest_cmd.extend(["-m", "security"])
else: # all
test_paths.append("tests/")
# Add test paths to command
pytest_cmd.extend(test_paths)
# Add pytest configuration
pytest_cmd.extend([
"--tb=short",
"--strict-markers",
"--disable-warnings"
])
# Run the tests
success = run_command(pytest_cmd, f"{args.suite.title()} Test Suite")
if success:
print(f"\n{args.suite.title()} tests passed!")
if args.coverage:
print("\n📊 Coverage report generated in htmlcov/index.html")
else:
print(f"\n{args.suite.title()} tests failed!")
sys.exit(1)
# Additional checks
if args.suite in ["all", "integration"]:
print("\n🔍 Running integration test checks...")
# Add any integration-specific checks here
if args.suite in ["all", "e2e"]:
print("\n🌐 Running E2E test checks...")
# Add any E2E-specific checks here
if args.suite in ["all", "security"]:
print("\n🔒 Running security scan...")
# Run security scan
security_cmd = ["bandit", "-r", "apps/"]
run_command(security_cmd, "Security Scan")
# Run dependency check
deps_cmd = ["safety", "check"]
run_command(deps_cmd, "Dependency Security Check")
if __name__ == "__main__":
main()