-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
Have you read the Contributing Guidelines on issues?
- I have read the Contributing Guidelines on issues.
WebdriverIO Version
9.19.2
Node.js Version
22.17.0
Mode
WDIO Testrunner
Which capabilities are you using?
What happened?
I want to generate a JUnit test report from Cucumber tests. I have installed @wdio/cucumber-framework and @wdio/junit-reporter, and configured wdio.conf.ts to use the JUnit reporter. Tests run fine, and the report is generated as expected.
Now I want to send this report to Testmo. The standard WDIO JUnit XML report is not particularly well formatted for Cucumber steps (they are all lumped together in the <system-out> section), so I would like to utilize Testmo's feature of extracting Cucumber steps from XML properties. The WDIO JUnit reporter provides the addProperty function that fits this usecase.
Unfortunately, calling addProperty in both the beforeStep and afterStep hooks of the WDIO config file does not result in any properties being added to the testcase in the resulting XML:
<testcase classname="CucumberJUnitReport-chrome.138_0_7204_101.mac.WDIO JUnit Test" name="JUnit Test" time="0.004">
<system-out><![CDATA[
✅ Given I am testing WDIO
✅ When I add custom properties
✅ Then they should be in the JUnit report
]]></system-out>
</testcase>I also tried the BeforeStep and AfterStep hooks from @wdio/cucumber-framework, with the same effect.
What is your expected behavior?
Custom properties are present in the generated JUnit XML:
<testcase classname="CucumberJUnitReport-chrome.138_0_7204_101.mac.WDIO JUnit Test" name="JUnit Test" time="0.004">
<properties>
<property name="stepnameBefore1" value="Given I am testing WDIO">
<property name="stepnameAfter1" value="Given I am testing WDIO">
<property name="stepnameBefore2" value="When I add custom properties">
<property name="stepnameAfter2" value="When I add custom properties">
<property name="stepnameBefore3" value="Then they should be in the JUnit report">
<property name="stepnameAfter3" value="Then they should be in the JUnit report">
</properties>
<system-out><![CDATA[
✅ Given I am testing WDIO
✅ When I add custom properties
✅ Then they should be in the JUnit report
]]></system-out>
</testcase>How to reproduce the bug.
Here is a minimal reproducible example matching the above XML snippets:
https://github.com/TDL-EdgarsEglitis/wdio-junit-cucumber-test
Relevant log output
See aboveCode of Conduct
- I agree to follow this project's Code of Conduct
Is there an existing issue for this?
- I have searched the existing issues