From e759f01e0c8a151b62acc01ddf4c0785fa5245cc Mon Sep 17 00:00:00 2001 From: pyth0n1c <87383215+pyth0n1c@users.noreply.github.com> Date: Tue, 30 Nov 2021 10:16:05 -0800 Subject: [PATCH] Better command line summary of pass and fail for summarize_json.py --- .../ci/detection_testing_batch/summarize_json.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/automated_detection_testing/ci/detection_testing_batch/summarize_json.py b/automated_detection_testing/ci/detection_testing_batch/summarize_json.py index 0e80a3782d..2aa1a7a277 100644 --- a/automated_detection_testing/ci/detection_testing_batch/summarize_json.py +++ b/automated_detection_testing/ci/detection_testing_batch/summarize_json.py @@ -7,7 +7,8 @@ from modules import validate_args import os.path from operator import itemgetter -def outputResultsJSON(output_filename:str, data:list[dict], baseline:OrderedDict)->bool: + +def outputResultsJSON(output_filename:str, data:list[dict], baseline:OrderedDict)->tuple[bool,int,int,int]: success = True try: @@ -70,7 +71,7 @@ def outputResultsJSON(output_filename:str, data:list[dict], baseline:OrderedDict #success = False #return success, False - return success + return success, test_count, pass_count, fail_and_error_count @@ -98,8 +99,11 @@ try: else: all_data['results'] = data['results'] - test_pass = outputResultsJSON(args.output_filename, all_data['results'], all_data['baseline']) - print("Successfully summarized [%d] detections"%(len(all_data['results']))) + test_pass, test_count, pass_count, fail_and_error_count = outputResultsJSON(args.output_filename, all_data['results'], all_data['baseline']) + print("Summary:"\ + "\n\tTotal Tests: %d"\ + "\n\tTotal Pass : %d"\ + "\n\tTotal Fail : %d"%(test_count, pass_count, fail_and_error_count)) if not test_pass: print("Result: FAIL") sys.exit(1)