]> granicus.if.org Git - esp-idf/commitdiff
test: include chip in test case ID
authorHe Yin Ling <heyinling@espressif.com>
Mon, 1 Apr 2019 07:16:47 +0000 (15:16 +0800)
committerHe Yin Ling <heyinling@espressif.com>
Fri, 19 Apr 2019 06:39:44 +0000 (14:39 +0800)
tools/tiny-test-fw/IDF/__init__.py
tools/tiny-test-fw/TinyFW.py

index 0e342e84420be15ac884a2488f264d69bef3ec8c..6887947231d02f632328ecaf80881c6b58b2f680 100644 (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):
index 61125caedd68d60b545b6c9ec1c2a543acc7fd93..f5ef7e1e693e406d30b8b0de042a75ce041df15b 100644 (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: