Test case name in JUnit XML not consistent when using scenario retries
When using Codecept with mocha-junit-reporter I noticed that testcase name is not always consistent and changes depending on whether retry is used on scenario or not.
For a test without any retries, its testcase always follows the pattern: <suite name>: <scenario name>. Including trimmed down XML for easier reading:
<testsuite name="JUnit reporting" timestamp="2025-04-30T12:34:22" tests="1" file="/path/to/test.js" time="10.966" failures="1">
<testcase name="JUnit reporting: Test 1" time="5.060" classname="Test 1">
If I use either Feature.retry(1) or Scenario.retry(1) the name of testcase omits the colon : character between suite and scenario name.
<testsuite name="JUnit reporting" timestamp="2025-04-30T12:34:22" tests="1" file="/path/to/test.js" time="10.966" failures="1">
<testcase name="JUnit reporting Test 1" time="5.060" classname="Test 1">
If the test uses retries but passes on 1st try the colon is still there:
<testsuite name="JUnit reporting" timestamp="2025-04-30T12:34:22" tests="1" file="/path/to/test.js" time="10.966" failures="0">
<testcase name="JUnit reporting: Test 1" time="5.060" classname="Test 1">
The full title seems to get modified somewhere during the retry but I haven't been able to identify where. It's missing no matter if the test passes or fails on the retry. I know it looks like a small difference but it's an inconvenience if you want to do any kind of automatic processing on output XML files.
package.json dependencies:
"dependencies": {
"codeceptjs": "^3.7.3",
"mocha-junit-reporter": "^2.2.1",
"playwright": "^1.52.0"
},
This is probably not affected by the type of helper used but I reproduced it using both Playwright and Webdriver.
I think the reason for this difference is that mocha's test.fullTitle() (which is space separated) gets overwritten with Codecept's version (which is delimited by colon) at the start when tests are added to suite: https://github.com/codeceptjs/CodeceptJS/blob/0025e2c76ad2dd802188ddd2213898d71efe5394/lib/mocha/test.js#L53
Not sure why this is the case since test.fullTitle() already exists at that point (at least from my limited testing) but once the retry is triggered it somehow reverts back to the initial implementation?
This issue is stale because it has been open for 90 days with no activity.