Guillermo F. Lopez
Guillermo F. Lopez

Reputation: 453

Jira REST API, JSON to create an Issue of type Test with test detail

So far I manage to create the Test issue, but I can't find the correct JSON structure to populate the field: customfield_11101 , name: Zephyr Teststep , required: false , type: any

I would like to be able to do something like this:

var issueTest = {
    "fields": {
      "issuetype": {
         "name": "Test"
      },
      "project":
      {
         "key": "STORYKEY"
      },
      "summary": "Navigate to a Different Region",
      "description": "",
      "assignee": {
          "name": "[email protected]"
      },
      "customfield_10014": "SOMEKEY",

      "duedate": "2018-10-03",
      "priority": {
        "name": "Blocker"
      },
      "labels": ["label1", "label2"],
      "customfield_19416": "50h",
      "customfield_19719": {
        "value": "minor"
      },
      "customfield_11101": [
        {
          "Test Step": "some text",
          "Test Data": "some text",
          "Test Result": "some text"
        },
        {
          "Test Step": "some text",
          "Test Data": "some text",
          "Test Result": "some text"
        },
        {
          "Test Step": "some text",
          "Test Data": "some text",
          "Test Result": "some text"
        }
      ]
   }
};

Upvotes: 1

Views: 378

Answers (2)

Guillermo F. Lopez
Guillermo F. Lopez

Reputation: 453

First I want the thanks @rorschach, his answer help me a lot.

I find a way. it is not ideal but works The idea is create the Test and use the new Test id to create the related steps using this (suggested by @rorschach):

http://docs.getzephyr.apiary.io/#reference/teststepresource/create-get-list-of-teststeps/create-new-teststep

Upvotes: 0

rorschach
rorschach

Reputation: 2947

I'm not completely familiar with the Zephyr fields but have you tried something like this:

"fields": {
  //other field data
  "customfield_11101": {
    "value": //put your array here
  }
}

If that doesn't work then find another issue in your JIRA instance that has that field filled out and query it through the API, you can then see what the structure of that field's value should be

Thirdly, if all else fails, Zephyr has their own API which you can probably use to make the changes you need. There's a separate TeststepResource endpoint even.

Upvotes: 2

Related Questions