Loading doc/generateDocumentationData.py +19 −9 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ from os.path import dirname, exists from os import makedirs, walk def create_json_of_robotfile(robot_file_to_be_processed: str): def create_json_of_robotfile(robot_file_to_be_processed: str, computestatistics: bool=False): folder_test_suites = dirname(dirname(__file__)) folder_result_path = f'{folder_test_suites}/doc/results' Loading @@ -17,14 +17,24 @@ def create_json_of_robotfile(robot_file_to_be_processed: str): if not exists(folder_result_path): makedirs(folder_result_path) #try: if computestatistics: try: data = GenerateRobotData(robot_file=robot_file, execdir=folder_test_suites) data.parse_robot() info = data.get_info() #except Exception as e: # print("WHILE GENERATING ROBOT DATA:", e) # info = dict() # info["error_while_parsing"] = True except Exception as e: print("WHILE GENERATING ROBOT DATA:", e) info = dict() info["error_while_parsing"] = True info["robotfile"] = robot_file_to_be_processed if(robot_path_to_be_processed.startswith("/")): robot_path_to_be_processed = robot_path_to_be_processed[1:] info["robotpath"] = robot_path_to_be_processed else: data = GenerateRobotData(robot_file=robot_file, execdir=folder_test_suites) data.parse_robot() info = data.get_info() with open(result_file, 'w') as fp: dump(obj=info, indent=2, fp=fp) Loading doc/statisticsDocumentationData.py 0 → 100644 +44 −0 Original line number Diff line number Diff line from generateDocumentationData import create_json_of_robotfile from os.path import dirname from os import walk from json import dump if __name__ == "__main__": basedir = dirname(dirname(__file__)) statistics = dict() testcases = [] number_of_failures = 0 number_of_all_testcases = 0 number_of_successes = 0 ROBOT_FILE_EXTENSION = ".robot" fullpath = basedir+"/TP/NGSI-LD" for root, dirs, files in walk(fullpath): for filename in files: if filename.endswith(ROBOT_FILE_EXTENSION): number_of_all_testcases += 1 name_of_test_case = filename[:-len(ROBOT_FILE_EXTENSION)] json_of_test_case = create_json_of_robotfile(name_of_test_case, True) statistics[name_of_test_case] = dict() strippedpath = root[len(fullpath)+1:] statistics[name_of_test_case]["path"] = strippedpath if "error_while_parsing" in json_of_test_case and json_of_test_case["error_while_parsing"] == True: statistics[name_of_test_case]["failed"] = True number_of_failures += 1 else: statistics[name_of_test_case]["failed"] = False number_of_successes += 1 testcases.append(json_of_test_case) print() print() print() print("THE FOLLOWING TESTCASES FAILED PARSING:") for testcasename, testcaseresult in statistics.items(): if testcaseresult["failed"] == True: print(testcasename+" "+testcaseresult["path"]) print("Out of "+str(number_of_all_testcases)+" testcases, "+str(number_of_failures)+" of them failed to be correctly parsed") with open("testcases.json", 'w') as fp: dump(obj=testcases, indent=2, fp=fp) No newline at end of file Loading
doc/generateDocumentationData.py +19 −9 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ from os.path import dirname, exists from os import makedirs, walk def create_json_of_robotfile(robot_file_to_be_processed: str): def create_json_of_robotfile(robot_file_to_be_processed: str, computestatistics: bool=False): folder_test_suites = dirname(dirname(__file__)) folder_result_path = f'{folder_test_suites}/doc/results' Loading @@ -17,14 +17,24 @@ def create_json_of_robotfile(robot_file_to_be_processed: str): if not exists(folder_result_path): makedirs(folder_result_path) #try: if computestatistics: try: data = GenerateRobotData(robot_file=robot_file, execdir=folder_test_suites) data.parse_robot() info = data.get_info() #except Exception as e: # print("WHILE GENERATING ROBOT DATA:", e) # info = dict() # info["error_while_parsing"] = True except Exception as e: print("WHILE GENERATING ROBOT DATA:", e) info = dict() info["error_while_parsing"] = True info["robotfile"] = robot_file_to_be_processed if(robot_path_to_be_processed.startswith("/")): robot_path_to_be_processed = robot_path_to_be_processed[1:] info["robotpath"] = robot_path_to_be_processed else: data = GenerateRobotData(robot_file=robot_file, execdir=folder_test_suites) data.parse_robot() info = data.get_info() with open(result_file, 'w') as fp: dump(obj=info, indent=2, fp=fp) Loading
doc/statisticsDocumentationData.py 0 → 100644 +44 −0 Original line number Diff line number Diff line from generateDocumentationData import create_json_of_robotfile from os.path import dirname from os import walk from json import dump if __name__ == "__main__": basedir = dirname(dirname(__file__)) statistics = dict() testcases = [] number_of_failures = 0 number_of_all_testcases = 0 number_of_successes = 0 ROBOT_FILE_EXTENSION = ".robot" fullpath = basedir+"/TP/NGSI-LD" for root, dirs, files in walk(fullpath): for filename in files: if filename.endswith(ROBOT_FILE_EXTENSION): number_of_all_testcases += 1 name_of_test_case = filename[:-len(ROBOT_FILE_EXTENSION)] json_of_test_case = create_json_of_robotfile(name_of_test_case, True) statistics[name_of_test_case] = dict() strippedpath = root[len(fullpath)+1:] statistics[name_of_test_case]["path"] = strippedpath if "error_while_parsing" in json_of_test_case and json_of_test_case["error_while_parsing"] == True: statistics[name_of_test_case]["failed"] = True number_of_failures += 1 else: statistics[name_of_test_case]["failed"] = False number_of_successes += 1 testcases.append(json_of_test_case) print() print() print() print("THE FOLLOWING TESTCASES FAILED PARSING:") for testcasename, testcaseresult in statistics.items(): if testcaseresult["failed"] == True: print(testcasename+" "+testcaseresult["path"]) print("Out of "+str(number_of_all_testcases)+" testcases, "+str(number_of_failures)+" of them failed to be correctly parsed") with open("testcases.json", 'w') as fp: dump(obj=testcases, indent=2, fp=fp) No newline at end of file