REST API - Creation of test cases and uploading test run status of test case in JIRA cloud version

Hariprasad Kumar December 3, 2023

Hello Community,

Have anyone tried uploading test cases and test run status using REST API. I would like to know the JSON format for adding test steps and updating the result of test steps.

I am able to create test case using below request but would like to include the steps for the test cases.

Request:
{
"fields" : { 
"project" : { "key" : "PROJKEY" } ,
"summary" : "Rest API Test Summary",
"description": {
      "content": [
        {
          "content": [
            {
              "text""REST API description",
              "type""text"
            }
          ],
          "type""paragraph"
        }
      ],
      "type""doc",
      "version"1
    },
"assignee" : {"name" : "assignee"} ,
"issuetype" :  { 
"name" : "Test" } ,
"labels" : ["Label1"

}
}

2 answers

0 votes
Preeti Verma
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!
April 10, 2024
0 votes
Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 3, 2023

Hi @Hariprasad Kumar 

welcome to the community.

I guess you are using jira native rest API to create the issue. (xray uses it‘s own rest api)

As far as I know there is no action to just add steps to an existing issue (at least not in cloud). Nevertheless this should be possible with importing JSON via the xray Rest API. see the following link. It describes how to import as well as the JSON tempate format.

https://docs.getxray.app/pages/viewpage.action?pageId=68411323

Best

Stefan

Hariprasad Kumar December 3, 2023

Hello @Stefan Salzl ,

Thanks for your reply.

Please find my questions below,

1) Response what I could see from the page in the form of job id rather than the actual test case # which we used to get in the same JIRA server API endpoint in the response. As part of cloud, do we need to first start the bulk job using endpoint "POST /api/v2/import/test/bulk" and then get the test case id once it successful using "GET /api/v2/import/test/bulk/{jobId}/status" endpoint. (For existing test execution)

2) How do I know which are the mandatory fields in the request I am sending (For existing test execution)

3) Will I be able to execute only the test case or is it compulsory to execute the steps within the test case (For existing test execution) 

Looking forward for your response.

Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 4, 2023

Hi @Hariprasad Kumar 

let‘s take one step back as I am not sure I can follow what you are trying to achieve. Could you please explain your whole use case from a kind of more functional/use case perspective? (I‘m was getting confused between test case and test execution so I‘m not quite sure whether you want to import a test case or test execution).

Best
Stefan

Hariprasad Kumar December 4, 2023

Please find my whole use case below,

1. Import new test cases for existing test execution

2. Import test execution for the imported test cases 

Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 4, 2023

Are you using xray test management plugin? which type of test case would you like to import? which test execution file would you like to import?

Could please specify part 1 in more details? what exactly do you mean with "new testcases for existing test execution"? do you mean an already existing test execution issue within jira? or an executed test in your SUT that you would like to make it visible in Jira?

Best
Stefan

Hariprasad Kumar December 5, 2023

Hello @Stefan Salzl,

Apologies for the late response.

Please find my answers below,

1. Are you using xray test management plugin? which type of test case would you like to import? which test execution file would you like to import? ==> No, i am not using the plugin. I would like to import 'Manual' test cases into JIRA cloud for a 'Test Set'. I used to use below end points in JIRA server for uploading my test cases

rest/api/3/issue/

2. Could please specify part 1 in more details? what exactly do you mean with "new testcases for existing test execution"? do you mean an already existing test execution issue within jira? or an executed test in your SUT that you would like to make it visible in Jira? ==> My bad. I uI'll rephrase it correctly. I used to upload my test cases to a test set and execute them in text executions.  

Hope it answers your question.

Thanks,

Hari

Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 10, 2023

Hi @Hariprasad Kumar 

this brings even more questions up as everything what you describes sounds like configurations/issue types from xray.

Could you maybe show a screenshot of your issues (test cases, test set,…) ?

Best
Stefan

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events