This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def map_test_cases_dynamic_way(test_case: str = None): | |
"""Method to map the test cases target functions based on test_case id received""" | |
print("The dynamic way calling...") | |
test_cases = {f'Test_{i:03}': f'test_function_{i:03}' for i in range(100)} | |
for tc, func in test_cases.items(): | |
if tc.find(test_case) >= 0: | |
print(f"Mapped test case found for tc: {tc} as : {func}") | |
status = eval(func)() | |
return status | |
else: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def map_test_cases_dict_way(test_case: str = None): | |
"""Method to map the test cases target functions based on test_case id received""" | |
print("The dictionary way calling...") | |
test_cases = { | |
'Test_001': test_function_001, | |
'Test_002': test_function_002, | |
'Test_003': test_function_003, | |
'Test_004': test_function_004, | |
'Test_005': test_function_005, | |
'Test_006': test_function_006, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def map_test_cases_traditional_way(test_case: str): | |
print("The traditional calling...") | |
# Traditional if..elif..elif in Python | |
if test_case == 'Test_001': | |
test_function_001() | |
elif test_case == 'Test_002': | |
test_function_002() | |
elif test_case == 'Test_003': | |
test_function_003() | |
elif test_case == 'Test_004': |