Jira integration required? XRAY - Update status

Sorry if this is a duplicate post; I haven’t been able to find any concrete documentation so far so any help is appreciated.

We want to do the following: run tests in Katalon that have the JIRA issue key on them and then update the test status on those issues depending on pass or fail of the test in katalon? we’re using XRAY test management for JIRA.

Can anyone help say for sure if this is possible and if so does it require the JIRA integration plugin from the store?

Thanks all!

1 Like

anyone experienced something similar?

Hi Adam

Have you found any solution to update testresults in XRay tests with Katalon?

Hi Ben,

Our trial version has expired now but when we ran tests or linked results to the JIRA issue it updated the separate “Katalon test status” field on the right hand side of the page; however it did NOT update the main XRAY test status field.

Is this expected?

Katalon doesn’t have, AFAIK, a specific integration with Xray.
You may follow the following tutorial to submit results back to Xray but a deeper integration requires development from Katalon side; maybe the Katalon team can provide feedback on it (please ask them for this integration)

https://confluence.xpand-it.com/display/XRAY/Testing+APIs+using+Katalon+Studio

I would also like native integration with Xray.

I created a batch file to upload the Junit_Report.xml generated by Kataon. I had to use a batch file because I needed a delay before using curl to upload the results.

When KataonC.exe executes from TestOps, the Junit_Report.xml is not generated until the Test Set is complete and closed. That means I can’t run curl directly from Katalon or Katalon’s TestListener “afterTestSuite”. Instead I have to use the batch with a delay.

Uploading using Curl will add the test case if it doesn’t exist and add the Pass/Fail.
JUnit is not mult-part so description, attachments, etc are not included. This is barebones test and status.
NOTE: Test name is full path included:
image

image

Step 1
Use TestListener “AfterTestSuite” to trigger batch file.
TestListener sends location of results folder to batch file.

@AfterTestSuite
def AfterTestSuite(TestSuiteContext testSuiteContext) {
‘Upload Junit_Report.xml results to Jira to create tests and test results’

  String folder = RunConfiguration.getReportFolder()
  KeywordUtil.logInfo('Loading results in [' + folder + '] to Xray')
  def a = Runtime.getRuntime().exec('cmd /C XrayUpload.bat ' + folder)

}

Step 2 - XRayUpload.bat (located in root folder of Katalon project)
NOTE: The testExecKey is fixed. It is my regression suite so no need to change it dynamically.
testExecKey=QTAK-1008

Execute batch file to “wait” and execute “curl”
@echo off
cls

::folder argument is first argument

::Execute batch from Katalon but wait xx seconds to give Katalon time to generate results.
::Execute from Katalon without waiting for cmd to complete.
@echo Begin delay > “%1\XrayUploadResults.txt”
ping 127.0.0.1 -n 60 > nul

@echo Generate Bearer Token >> “%1\XrayUploadResults.txt”

::Generate Bearer token
for /f %%a in (‘curl -H “Content-Type: application/json” -X POST --data “{ ““client_id””: ““JiraClientId””,”“client_secret”“: ““JiraClientSecret”” }” https://xray.cloud.xpand-it.com/api/v1/authenticate’) do (
set “$token=%%a”
goto:next)

:next
::echo The token is : %$token%

@echo Folder is %1 >> “%1\XrayUploadResults.txt”
@echo Start Upload >> “%1\XrayUploadResults.txt”
::Execute curl to upload Junit_Report.xml to Xray.
::Path to xml is the single parameter passed to the batch file.
curl -H “Content-Type: text/xml” -X POST -H “Authorization: Bearer %$token%” --data @“%1\Junit_Report.xml” https://xray.cloud.xpand-it.com/api/v2/import/execution/junit?testExecKey=QTAK-1008

@echo End Upload >> “%1\XrayUploadResults.txt”

:: **** END ****

1 Like