Search code examples
jenkinsjenkins-pipelinejira-xray

Problem using XrayExportBuilder in Jenkins pipeline


I try to integrate XRay in my Jenkins pipeline (declarative) so I add a step like this:

stage('Export features from Xray') {
         steps{
             catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE'){
             step([$class: 'XrayExportBuilder', filePath: 'repoName/src/test/resources/io/cucumber/suite', filter: '21082', serverInstance: '770abc84-96c5-499c-b0d4-84baec112730'])
             
             }
         }         
     }

By the end I get all features exported into one file which is a problem for further test execution process, because only 1st scenario is being processed.

Here is a console log:

    Starting XRAY: Cucumber Features Export Task...
##########################################################
####   Xray is exporting the feature files  ####
##########################################################
Filter: 21082
Will save the feature files in: repoName/src/test/resources/io/cucumber/suite
###################### Unzipping file ####################
###################### Unzipped file #####################
Successfully exported the Cucumber features
XRAY_RAW_RESPONSE: 
XRAY_TEST_EXECS: 
XRAY_ISSUES_MODIFIED: 
XRAY_IS_REQUEST_SUCCESSFUL: true
XRAY_TESTS: 

As far as I know XrayExportBuilder puts features in separate files when it is set up (using jenkins UI) as a part of a custom job (not a pipeline). Is there any chance to optimize the export in the same way in a pipeline job?

upd. Seems like business logic of xray cloud version doesn't include possibility to use proper export of xray test-cases into separate feature-files in case if these test-cases aren't linked to any jira-task/requirement/story.

The problem comes when you link one test-case to several tickets. Then exportBuilder creates feature-files for each linked jira-issue and as a result duplicates mentioned test-cases into each feature-file


Solution

  • In fact Xray generates one feature per requirement as stated in the documentation: https://docs.getxray.app/display/XRAYCLOUD/Generate+Cucumber+Features And these rules are the base of all exports of Cucumber features.

    If you have a suggestion please use the support link to add it: https://jira.getxray.app/servicedesk/customer/portal/2/user/login?destination=portal%2F2.