-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_tests.py
More file actions
36 lines (28 loc) · 1.32 KB
/
run_tests.py
File metadata and controls
36 lines (28 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import argparse
import logging
from api_test_framework import Config, TestRunner, TestGenerator, Reporter
def setup_logging(level):
logging.basicConfig(level=level, format='%(asctime)s - %(levelname)s - %(message)s')
def main():
parser = argparse.ArgumentParser(description='Run API tests')
parser.add_argument('--config', default='config.yaml', help='Path to the configuration file')
parser.add_argument('--workers', type=int, default=5, help='Number of worker threads')
parser.add_argument('--log-level', default='INFO', choices=['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'],
help='Set the logging level')
args = parser.parse_args()
setup_logging(logging.DEBUG)
logging.info(f"Loading configuration from {args.config}")
config = Config(args.config)
test_generator = TestGenerator(config)
test_runner = TestRunner(config, test_generator)
reporter = Reporter()
logging.info(f"Running tests with {args.workers} workers")
results = test_runner.run_tests(max_workers=args.workers)
reporter.add_results(results)
reporter.print_summary()
reporter.save_json_report()
reporter.save_csv_report()
reporter.save_html_report()
logging.info(f"Test execution completed. Reports saved in {reporter.output_dir}")
if __name__ == '__main__':
main()