medtoure18 / codeceptjs-xray-helper

A Codeceptjs helper which can publish tests results on Xray api
1 stars 2 forks source link

codeceptjs-xray-helper

codeceptjs-xray-helper is a CodeceptJS helper which can publish tests results on XRAY api after tests execution.

Installation

npm install codeceptjs-xray-helper --save

Configuration

This plugin should be added in codecept.json/codecept.conf.js

Example:

{
  ...
   plugins: {
    xrayReport: {
       require: "codeceptjs-xray-helper",
       enabled: true,
       debug:false,
       jira_url: 'https://localhost-jira',
       jira_user: 'root',
       jira_password: 'root',
       test_revison: '001',
       testEnvironments: '["browser:chrome", "linux"]',
       testsExportedFromTestExecution:false
    }
  ...
}
To use this plugin you need to provide the following infos:
_jiraurl

Your JIRA host url for exemple: http://localhost:8080

_jira_user & jirapassword

Your JIRA user keys, only for jira server

_xray_cloud & xray_clientId & xrayclientSecret

if you are in jira cloud you have to set theses options

xray_cloud: true
xray_clientId: XXXX
xray_clientSecret: XXXX
to get your cloud clientId see: https://docs.getxray.app/display/ProductKB/%5BXray+Cloud%5D+How+to+use+REST+API+with+Xray+for+Jira+Cloud
_testrevison

You can send your test revision (it could be your feature name for example). If this config is empty 001 will be sent to xray instead

test_revison_example

testEnvironments

Test environnement that will be set on Test Environnements field in Test Execution issue

testEnvironments_example

debug

to turn on the debug mode for the helper

testsExportedFromTestExecution

not mandatory, set to true if you have exported your cumcumber files from Test Plan or Test Set: New Test Execution will be generated

timeOut

not mandatory, set the timeOut in MS of the request to jira api default 1200

proxy

not mandatory, set the proxy if you need a proxy to reach your jira instance example: proxy:"http://xxx.xx.xx.00:3128"

Example:

when debug is true


OK  | 1 passed   // 57s
SEND TO XRAY=>{ "testExecutionKey": "PCR-6","info" : {"startDate" : "2020-07-08T15:41:10+02:00", "finishDate" :"2020-07-08T15:41:10+02:00","revision": "001","description" : "Results of test execution ", "testEnvironments": ["browser:chrome", "linux"]},"tests" : [{"testKey":"PCR-1","status":"PASS","comment" : "Successful execution" }]}
XRAY RESPONSE=>{"testExecIssue":{"id":"134806","key":"PCR-6","self":"https://localhost:8080/rest/api/2/issue/134806"},"testIssues":{"success":[{"id":"134801","key":"PCR-1","self":"https://localhost:8080/rest/api/2/issue/134801"}]}}
Tests results sended to XRAY on TestExecution: PCR-6
mtoure@E5450:~/workspace/demo-xray-bdd(master)$ 

Export features files on Xray side

Feature files have to be exported from an Test Execution issue.

Failed tests

Screenshot on xray side

On failure

Failed tests

On success

Succeeded tests