I have integrated XRAY with webdriver IO , mocha using the guide below
https://docs.getxray.app/display/XRAYCLOUD/Testing+web+applications+using+Mocha+and+WebdriverIO#tab-API https://docs.getxray.app/display/XRAY/Import+Execution+Results+-+REST#ImportExecutionResultsREST-JUnitXMLresults
WDIO Config for JUnit reporter:
reporters: ['spec',
['junit', {
outputDir: './',
outputFileFormat: function(options) {
return `results.xml`
}
}],
Curl to import results.xml into XRAY:
curl -H "Content-Type: multipart/form-data" -u "UserName":"PASSWORD" -F "file=@results.xml" "${URL}/rest/raven/1.0/import/execution/junit?projectKey=${projectKey}&testPlanKey=${testPlanKey}"
Commands to run test suite(s):
Run single suite: npm run --suite mysuite1
Run multiple suites: npm run --suite mysuite1 --suite mysuite2
When single suite is executed, result.xml is created and successfully imported into XRAY. But when multiple suites are executed as above, result.xml has test result of the last suite only and thus only test results for the last suite are imported into XRAY.
As XRAY import API needs projectkey and testplankey, a result file should be created for each suite and import API to be invoked for each result file with right file name, project and plan.
What could help is a way to amend result file name which could be associated with the test plan e.g. result_mysuite1.xml.
Please let me know if more information is needed.
Thanks in advance, Mahima.