JUnit Xray Reporter is a custom reporter for use with Mocha, XRay (Native Test Management for Jira) and WebDriverIo testing frameworks.
The reporter helps you to integrate your wdio/Mocha test with XRay easily by producing enriched JUnit-style XML test report files which can be uploaded into XRay with API or other tools.
The reporter is built on the top of @wdio/junit-reporter v8.16.17 so all the configurations in the official doc, are inherited from this npm package.
This reporter offers the ability to specify a Jira-Issue for each it{} inside your wdio test and creates a custom report that is easy to load into XRay.
As a dev module:
$ npm install wdio-junit-xray-reporter --save-dev
or as a global module:
$ npm install -g wdio-junit-xray-reporter
describe('My First Test', () => {
it('Does not do much! | CALC-1234', () => {
expect(true).to.equal(true);
})
})
TODO
Every other {reporterOptions} explained here: @wdio/junit-reporter v8.16.17 are availabile.
- Install 'wdio-junit-xray-reporter' to the wdio project
$ npm install wdio-junit-xray-reporter --save-dev
- Configure 'wdio-junit-xray-reporter' as the reporter and do other configurations as necessary. Configurations can be done in the wdio.config.js or in the command line.
Add this to wdio.config.js
TODO
- Add wdio test with XRay-related elements
describe('My First Test', () => {
it('Does not do much! | CALC-1234', () => {
expect(true).to.equal(true);
})
})
- Run tests and generate report
npx wdio run --spec "path/to/file"
- View report file
Report file generated at '<wdio_project_root>/wdio/results'.
"my-test-output-828a1c4885dc687b1a19e11e24b9437e.xml"
<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="Mocha Tests" time="0.1070" tests="1" failures="0">
<testsuite name="Root Suite" timestamp="2023-01-27T13:51:23" tests="0" file="wdio\e2e\test.cy.js" time="0.0000" failures="0">
</testsuite>
<testsuite name="My First Test" timestamp="2023-01-27T13:51:23" tests="1" time="0.0700" failures="0">
<testcase name="My First Test Does not do much!" time="0.0820" classname="Does not do much!">
<properties>
<property name="test_key" value="CALC-1234"/>
</properties>
</testcase>
</testsuite>
</testsuites>
As you can see the property has beenn added and now could be readed correctly by XRay.
<properties>
<property name="test_key" value="CALC-1234"/>
</properties>
- Now just upload the report to XRay and the card in Jira will be updated automatically
Happy testing to everyone!
a.