Skip to content

Commit c5c4165

Browse files
golowanowkartben
authored andcommitted
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 <[email protected]>
1 parent b69a8d1 commit c5c4165

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

doc/releases/release-notes-4.1.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ Build system and Infrastructure
126126
as well as for ``--sub-test`` command line parameters (:github:`80088`).
127127
* The ``--no-detailed-test-id`` command line option also shortens Ztest Test Case names excluding
128128
its Test Scenario name prefix which is the same as the parent Test Suite id (:github:`82302`).
129+
Twister XML reports have full testsuite name as ``testcase.classname property`` resolving
130+
possible duplicate testcase elements in ``twister_report.xml`` testsuite container.
129131

130132
Drivers and Sensors
131133
*******************

scripts/pylib/twister/twisterlib/reports.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,14 +171,14 @@ def xunit_report_suites(self, json_file, filename):
171171
runnable = suite.get('runnable', 0)
172172
duration += float(handler_time)
173173
ts_status = TwisterStatus(suite.get('status'))
174+
classname = PosixPath(suite.get("name","")).name
174175
for tc in suite.get("testcases", []):
175176
status = TwisterStatus(tc.get('status'))
176177
reason = tc.get('reason', suite.get('reason', 'Unknown'))
177178
log = tc.get("log", suite.get("log"))
178179

179180
tc_duration = tc.get('execution_time', handler_time)
180181
name = tc.get("identifier")
181-
classname = ".".join(name.split(".")[:2])
182182
fails, passes, errors, skips = self.xunit_testcase(eleTestsuite,
183183
name, classname, status, ts_status, reason, tc_duration, runnable,
184184
(fails, passes, errors, skips), log, True)
@@ -252,14 +252,14 @@ def xunit_report(self, json_file, filename, selected_platform=None, full_report=
252252
):
253253
continue
254254
if full_report:
255+
classname = PosixPath(ts.get("name","")).name
255256
for tc in ts.get("testcases", []):
256257
status = TwisterStatus(tc.get('status'))
257258
reason = tc.get('reason', ts.get('reason', 'Unknown'))
258259
log = tc.get("log", ts.get("log"))
259260

260261
tc_duration = tc.get('execution_time', handler_time)
261262
name = tc.get("identifier")
262-
classname = ".".join(name.split(".")[:2])
263263
fails, passes, errors, skips = self.xunit_testcase(eleTestsuite,
264264
name, classname, status, ts_status, reason, tc_duration, runnable,
265265
(fails, passes, errors, skips), log, True)

0 commit comments

Comments
 (0)