twister: reports: Long testcase.classname XML properties

The testcase.classname properties in `twister_report.xml` and
`twister_suite_report.xml` now contain the full testsuite name
(without its path prefix) instead of just two its dot-separated
leftmost components. This way `twister_report.xml` testsuite container
has no duplicate testcase elements with the same `classname` and `name`
properties executing with --no-detailed-test-id for a project with same
testcase names in its 'sibling' suites, for example`tests/kernel/sleep`.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
This commit is contained in:
Dmitrii Golovanov 2024-12-15 17:43:56 +01:00 committed by Benjamin Cabé
commit c5c4165f68
2 changed files with 4 additions and 2 deletions

View file

@ -126,6 +126,8 @@ Build system and Infrastructure
as well as for ``--sub-test`` command line parameters (:github:`80088`).
* The ``--no-detailed-test-id`` command line option also shortens Ztest Test Case names excluding
its Test Scenario name prefix which is the same as the parent Test Suite id (:github:`82302`).
Twister XML reports have full testsuite name as ``testcase.classname property`` resolving
possible duplicate testcase elements in ``twister_report.xml`` testsuite container.
Drivers and Sensors
*******************

View file

@ -171,6 +171,7 @@ class Reporting:
runnable = suite.get('runnable', 0)
duration += float(handler_time)
ts_status = TwisterStatus(suite.get('status'))
classname = PosixPath(suite.get("name","")).name
for tc in suite.get("testcases", []):
status = TwisterStatus(tc.get('status'))
reason = tc.get('reason', suite.get('reason', 'Unknown'))
@ -178,7 +179,6 @@ class Reporting:
tc_duration = tc.get('execution_time', handler_time)
name = tc.get("identifier")
classname = ".".join(name.split(".")[:2])
fails, passes, errors, skips = self.xunit_testcase(eleTestsuite,
name, classname, status, ts_status, reason, tc_duration, runnable,
(fails, passes, errors, skips), log, True)
@ -252,6 +252,7 @@ class Reporting:
):
continue
if full_report:
classname = PosixPath(ts.get("name","")).name
for tc in ts.get("testcases", []):
status = TwisterStatus(tc.get('status'))
reason = tc.get('reason', ts.get('reason', 'Unknown'))
@ -259,7 +260,6 @@ class Reporting:
tc_duration = tc.get('execution_time', handler_time)
name = tc.get("identifier")
classname = ".".join(name.split(".")[:2])
fails, passes, errors, skips = self.xunit_testcase(eleTestsuite,
name, classname, status, ts_status, reason, tc_duration, runnable,
(fails, passes, errors, skips), log, True)