简体   繁体   中英

Custom field for test plan in jira xray

I'm tring to import results to jira Xray using Rest API cucumber/mutipart with the following curl command:

curl -H  "Authorization: Bearer $token"  -F info=@Exec.json -F result=@file.json   https://server/rest/raven/2.0/import/execution/cucumber/multipart

As this command creates a new test execution and we cannot report results to an existing one as bug mentionned https://jira.getxray.app/browse/XRAYCLOUD-2375 So I tried to add custom field related to test plan that already created the problem that I cannot find the exact custom field's number I get always this error

{"error":"Error assembling issue data: Field \u0027customfield_11218\u0027 cannot be set. It is not on the appropriate screen, or unknown."

Here my Exec.json:

{
    "fields": {
        "project": {
            "key": "project"
        },
        "summary": "Test Execution for cucumber Execution",
        "issuetype": {
            "name": "Test Execution"
        },
        "customfield_11218" : "ODI-1103"
    }
}

I get the custom field for xml file exported from a test related to test plan:

<customfield id="customfield_11218" key="com.xpandit.plugins.xray:test-plans-associated-with-test-custom-field">
<customfieldname>Test Plans associated with a Test</customfieldname>
<customfieldvalues>
<customfieldvalue>[ODI-1103]</customfieldvalue>
</customfieldvalues>
</customfield>

In the case of Cucumber JSON reports, it's currently kind of an exception. If we want to link the results to a Test Plan, then we need to use the multipart endpoint that you mentioned.. which in turn always creates a new Test Execution.

The syntax for the JSON content used to customize the Test Execution fields should be something like:

{ 
    "fields": {
        "project": {
            "key": "CALC"
        },
        "summary": "Test Execution for Cucumber execution",
        "description": "This contains test automation results",
        "fixVersions": [ {"name": "v1.0"}],
        "customfield_11805": ["chrome"],
        "customfield_11807": ["CALC-8895"]
    }
}

(you can see a code example here ; that repository contains examples in other languages)

In the previous example, the Test Plan custom field is "customfield_11807". Note that the value is not a string but an array of string of the issue keys of the connected Test Plans (usually just one).

From what you shares, it seems that you are referring to another custom field which has a similar name. You should look for a custom field named "Test Plan" that has this description "Associate Test Plans with this Test Execution" (unless someone changed it).

To find the custom field id, you can ask your Jira admin to go to Custom Fields and then edit the field named "Test Plan"... Or you can also use Jira's REST API for that:)

https://yourjiraserver/rest/api/2/customFields?search=test%20plan

This will return a JSON content where you can see some custom fields, and you'll be able to depict the one you're looking for.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM