This is a 2 classes package that allows you to easily connect to an xray server, and upload junit reports, using as reference this xray-doc
- npm install xray-client
Package contains only one public method reportToXray(options) where the options are
project
: Name of the jira server project where you are pushing the resultstestPlan
: Name of the jira testplan where you are pushing the resultsresultsFolder
: Path to the folder where the testsresults are stored after executionfileName
: Name of the xml file name to be uploaded to xraycleanupFilesAfterUpload
: Setting this true will delete all the test results in the folder after uploading themhost
: url to jira server apisecurity
: parameter to pass client_id and client_secret
const {reportToXrayWithJunitReport} = require("xray-client");
let resultsDir = resolve(__dirname, './results/junit');
let options = {
project: 'jira-project',
testPlan: 'QA-14',
resultsFolder: resultsDir,
fileName: 'results.xml',
host: 'https://xray.cloud.getxray.app/api/v1',
security: {
client_id: 'username',
client_secret: 'password'
}
}
await reportToXrayWithJunitReport(options);
IMPORTANT: This works on the premise that you are adding test ids in the allure report too as it extract it from the xml to generate the request, if you want to link issues you should add them too.
Package contains only one public method reportToXray(options) where the options are
project
: Name of the jira server project where you are pushing the resultstestPlan
: Name of the jira testplan where you are pushing the resultstestExecutionKey
: [OPTIONAL] Name of the jira execution where you are pushing the results, in case you leave empty, it will create a new execution under test planresultsFolder
: Path to the folder where the testsresults are stored after executionhost
: url to jira server apisecurity
: parameter to pass client_id and client_secret
const {reportToXrayWithAllureReport} = require("xray-client");
let resultsDir = resolve(__dirname, './results/allure');
let options = {
project: 'DEMO',
testPlan: 'DEMO-1',
testExecutionKey: '',
resultsFolder: resultsDir,
title: 'Your title',
host: 'https://xray.cloud.getxray.app/api/v2',
security: {
client_id: 'username',
client_secret: 'password'
},
};
await reportToXrayWithAllureReport(options);