This accelerator can be used to publish the test results which were generated from well known test frameworks such as:
- Cucumber
- Egg Plant
- JUNIT
- Selenium
- SoapUI
- TestNG
- Tricentis Tosca
- UFT
to Zephyr Squad.
Install zephyr-integration
npm install --save-dev zephyr-integration
Create config.json file to store required configuration:
{
"url": <zephyr-url>,
"projectKey": <project-key>,
"cycleName" : <name-of-the-cycle>,
"automationFramework": <framework-name>,
"createNewCycle": "true/false",
"createNewFolder": "true/false",
"versionName": <version-in-zephyr>,
"jobDescription": <some-description>,
"prefix": <prefix-foleder-name>
}
Following environment variables must be set in order to use the tool:
Environment Variable | Value |
---|---|
INPUT_REPORT_DIR | Directory where the report files are stored |
CONSOLIDATE_REPORT | Path to the consolidated report file which will be used to publish the results |
ZEPHYR_ACCESS_KEY | How to get access and secret key |
ZEPHYR_SECRET_KEY | How to get access and secret key |
ZEPHYR_ACCOUNT_ID |
|
ZEPHYR_API_URL | Production URL of Zephyr API |
ZEPHYR_ACCOUNT_LABEL | Your account label, eg: Thanh Le |
ZEPHYR_ACCOUNT_NAME | Your account name, eg: Thanh Le |
const zephyr = require('zephyr-integration').zephyr
zephyr.initialize('./config.json').then((z) => {
z.createAutomationTask().then((response1) => {
if (response1) {
const data = response1.data;
console.log(data);
const pattern =
/Job has been successfully created, Job id is : ([\w]+)/gm;
const match = pattern.exec(JSON.stringify(data));
if (match) {
const jobId = match[1];
z.executeAutomationTask(jobId).then((response2) => {
if (response2) {
console.log(response2.data);
}
z.deleteAutomationTask(jobId).then((response3) => {
if (response3) {
console.log(response3.data);
}
});
});
} else {
console.log(JSON.stringify(data));
throw new Error(
'Something wrong when trying to create new automation task.'
);
}
}
});
});
This has been tested only with Zephyr Squad Cloud and Cucumber. Some parts of the codes are still focusing to solve Cucumber case. Need further changes for other framework.
You are welcome to contribute! Steps to contribute:
- Create an issue here
- Work on your feature and test it properly.
- Create Pull Request and add engineering-qe-reviewers as the reviewer.