ci: add dut_log_url column to failed testcases report

Introduced changes:
- add xml attribute "dut_log_url" to pytest report
- add column "dut_log_url" to failed testcases table of dynamic pipeline report
- make the table header sticky
- add permalinks to the Table Titles
- split target test report by testcase type for better clarity
- fix the logic of finding the testcases failed on cur branch / other branches
This commit is contained in:
Aleksei Apaseev
2024-07-02 17:38:41 +08:00
parent 7d3ac1abe4
commit cd59d96ff4
12 changed files with 574 additions and 245 deletions

View File

@ -252,6 +252,34 @@ def set_test_case_name(request: FixtureRequest, test_case_name: str) -> None:
request.node.funcargs['test_case_name'] = test_case_name
@pytest.fixture(autouse=True)
def set_dut_log_url(record_xml_attribute: t.Callable[[str, object], None], _pexpect_logfile: str) -> t.Generator:
# Record the "dut_log_url" attribute in the XML report once test execution finished
yield
if not isinstance(_pexpect_logfile, str):
record_xml_attribute('dut_log_url', 'No log URL found')
return
ci_pages_url = os.getenv('CI_PAGES_URL')
logdir_pattern = re.compile(rf'({DEFAULT_LOGDIR}/.*)')
match = logdir_pattern.search(_pexpect_logfile)
if not match:
record_xml_attribute('dut_log_url', 'No log URL found')
return
if not ci_pages_url:
record_xml_attribute('dut_log_url', _pexpect_logfile)
return
job_id = os.getenv('CI_JOB_ID', '0')
modified_ci_pages_url = ci_pages_url.replace('esp-idf', '-/esp-idf')
log_url = f'{modified_ci_pages_url}/-/jobs/{job_id}/artifacts/{match.group(1)}'
record_xml_attribute('dut_log_url', log_url)
######################
# Log Util Functions #
######################