mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-09 20:41:14 +00:00
feat(tiny_test_fw): unify all junit report test case name
new format: <target>.<config>.<case_name>, the default value of "config" is "default"
This commit is contained in:
@@ -22,6 +22,7 @@ from datetime import datetime
|
||||
import junit_xml
|
||||
|
||||
from . import DUT, App, Env, Utility
|
||||
from .Utility import format_case_id
|
||||
|
||||
|
||||
class TestCaseFailed(AssertionError):
|
||||
@@ -98,7 +99,7 @@ class JunitReport(object):
|
||||
def output_report(cls, junit_file_path):
|
||||
""" Output current test result to file. """
|
||||
with open(os.path.join(junit_file_path, cls.JUNIT_FILE_NAME), 'w') as f:
|
||||
cls.JUNIT_TEST_SUITE.to_file(f, [cls.JUNIT_TEST_SUITE], prettyprint=False)
|
||||
junit_xml.to_xml_report_file(f, [cls.JUNIT_TEST_SUITE], prettyprint=False)
|
||||
|
||||
@classmethod
|
||||
def get_current_test_case(cls):
|
||||
@@ -195,9 +196,9 @@ 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['ID'])
|
||||
junit_test_case = JunitReport.create_test_case(format_case_id(case_info['ID'],
|
||||
target=env_inst.default_dut_cls.TARGET))
|
||||
result = False
|
||||
|
||||
try:
|
||||
Utility.console_log('starting running test: ' + test_func.__name__, color='green')
|
||||
# execute test function
|
||||
|
@@ -110,3 +110,7 @@ def handle_unexpected_exception(junit_test_case, exception):
|
||||
# AssertionError caused by an 'assert' statement has an empty string as its 'str' form
|
||||
e_str = str(exception) if str(exception) else repr(exception)
|
||||
junit_test_case.add_failure_info('Unexpected exception: {}\n{}'.format(e_str, traceback.format_exc()))
|
||||
|
||||
|
||||
def format_case_id(case_name, target='esp32', config='default'):
|
||||
return '{}.{}.{}'.format(target, config, case_name)
|
||||
|
@@ -34,10 +34,6 @@ TARGET_DUT_CLS_DICT = {
|
||||
}
|
||||
|
||||
|
||||
def format_case_id(target, case_name):
|
||||
return '{}.{}'.format(target, case_name)
|
||||
|
||||
|
||||
try:
|
||||
string_type = basestring
|
||||
except NameError:
|
||||
@@ -128,7 +124,6 @@ def test_func_generator(func, app, target, ci_target, module, execution_time, le
|
||||
dut_dict=dut_classes, **kwargs
|
||||
)
|
||||
test_func = original_method(func)
|
||||
test_func.case_info['ID'] = format_case_id(target, test_func.case_info['name'])
|
||||
return test_func
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user