test: include chip in test case ID

This commit is contained in:
He Yin Ling 2019-04-01 15:16:47 +08:00
parent b7d26ddfe3
commit af4daf6a22
2 changed files with 23 additions and 5 deletions

View File

@ -20,6 +20,10 @@ from IDF.IDFApp import IDFApp, Example, UT
from IDF.IDFDUT import IDFDUT
def format_case_id(chip, case_name):
return "{}.{}".format(chip, case_name)
def idf_example_test(app=Example, dut=IDFDUT, chip="ESP32", module="examples", execution_time=1,
level="example", erase_nvs=True, **kwargs):
"""
@ -41,8 +45,15 @@ def idf_example_test(app=Example, dut=IDFDUT, chip="ESP32", module="examples", e
except AttributeError:
pass
return TinyFW.test_method(app=app, dut=dut, chip=chip, module=module,
execution_time=execution_time, level=level, **kwargs)
original_method = TinyFW.test_method(app=app, dut=dut, chip=chip, module=module,
execution_time=execution_time, level=level, **kwargs)
def test(func):
test_func = original_method(func)
test_func.case_info["ID"] = format_case_id(chip, test_func.case_info["name"])
return test_func
return test
def idf_unit_test(app=UT, dut=IDFDUT, chip="ESP32", module="unit-test", execution_time=1,
@ -66,8 +77,15 @@ def idf_unit_test(app=UT, dut=IDFDUT, chip="ESP32", module="unit-test", executio
except AttributeError:
pass
return TinyFW.test_method(app=app, dut=dut, chip=chip, module=module,
execution_time=execution_time, level=level, **kwargs)
original_method = TinyFW.test_method(app=app, dut=dut, chip=chip, module=module,
execution_time=execution_time, level=level, **kwargs)
def test(func):
test_func = original_method(func)
test_func.case_info["ID"] = format_case_id(chip, test_func.case_info["name"])
return test_func
return test
def log_performance(item, value):

View File

@ -185,7 +185,7 @@ def test_method(**kwargs):
# prepare for xunit test results
junit_file_path = env_inst.app_cls.get_log_folder(env_config["test_suite_name"])
junit_test_case = JunitReport.create_test_case(case_info["name"])
junit_test_case = JunitReport.create_test_case(case_info["ID"])
result = False
try: