How to add test evidence like docx, pdf to the test run evidence using JIRA API ?

Shibanjan Mondal
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 21, 2024

How do i add any type of document evidence to the particular test run evidence using JIRA API.

You can go to the page i am referring to by -

Story -> subtest execution -> execution details -> evidences -> add evidence 

the test type is Cucumber.

JIRA is already integrated with XRAY plugin.

 

I am trying to attach using REST API. I have looked through XRAY documentations but could not achieve the result. 

1 answer

0 votes
Manuel
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 25, 2024

1. Option 1: add attachments while running the tests

Assuming that you're using a Cucumber JSON report, that information can be added while running your tests, by adding it in your Cucumber Java code (are you using Java to make the steps code?), for example after a scenario fails.

 

https://javadoc.io/doc/io.cucumber/cucumber-core/4.7.2/io/cucumber/core/api/Scenario.html


@
After
public void doSomethingAfter(Scenario scenario){

if (scenario.isFailed()) {
scenario.embed(((TakesScreenshot)driver).getScreenshotAs(OutputType.BYTES), "image/png");
}

}

 

This screenshot will be embed on the cucumber json report, and Xray will show it in the UI after you import the results.

 

2. Option 2: submit evidence after uploading the test results

 

This is trickier. To add the evidence to the test run, you'll need to use GraphQL API for that.

You could also the evidence to the Test Execution issue; this would be possible using Jira REST API for adding attachments to issues; however, it would be a bit cumbersome as the Test Execution usually contains results related with several test runs (and not just one)

 

Suggest an answer

Log in or Sign up to answer