UpdateTestCase - Update a test case

Updated at:

Applicable editions

Central edition, Region edition

Endpoints and authorization

  • Obtain an endpoint. Replace {domain} in the request syntax with the endpoint.
  • Obtain a personal access token.
  • Obtain an organization ID: Required only for the Central edition. Go to the organization management console and obtain the organization ID from the basic information page.

Product

Resource

Required permissions

Test management

Test case

Read and write

Request syntax

Central edition

PUT https://{domain}/oapi/v1/testhub/organizations/{organizationId}/testRepos/{testRepoId}/testcases/{id}

Region edition

PUT https://{domain}/oapi/v1/testhub/testRepos/{testRepoId}/testcases/{id}

Request headers

Parameter

Type

Required

Description

Example value

x-yunxiao-token

string

Yes

The personal access token.

pt-0fh3****0fbG_35af****0484

Request parameters

Parameter

Type

Location

Required

Description

Example value

organizationId

string

path

  • Yes (Central edition)

  • No (Region edition)

The organization ID.

testRepoId

string

path

Yes

The ID of the test case repository.

id

string

path

Yes

The ID of the test case.

-

object

body

No

A flat set of field key-value pairs, where each key is a field ID. Only the specified fields are updated, and omitted fields remain unchanged. An empty string clears a field, except for required fields, which cannot be cleared. In addition to the fields listed below, the ID of any custom field returned by the GetTestcaseFieldConfig operation can also be specified as a key. The folder (directoryId) cannot be changed by this operation.

assignedTo

string

body

No

The owner. Specify a user ID. User names are not supported.

user-id-xxx

labels

array[string]

body

No

The list of label IDs. The value overwrites all existing labels. A comma-separated string is also accepted.

preCondition

string

body

No

The preconditions. By default, the value is processed as plain text and converted to rich text for storage. Line breaks in the text are converted to paragraphs.

The user is registered and logged on

preConditionFormat

string

body

No

The format of the preconditions. Valid values: RICHTEXT and TEXT. Default value: TEXT. TEXT: the value is processed as plain text. The server escapes HTML and converts line breaks to paragraphs. RICHTEXT: the value is already HTML and the server preserves it without escaping. This parameter takes effect only when preCondition is also specified.

TEXT

subject

string

body

No

The title. This parameter cannot be empty.

Verify that the logon feature is available

testSteps

object

body

No

content

array

body

No

The test step entries when contentType is set to TABLE. Write the expected result in the expected field of each entry. If contentType is set to TEXT and neither stepContent nor expectedResult is specified, the first entry is used as the test step and the expected result.

-

object

body

No

expected

string

body

No

The expected result.

Expected result 1

step

string

body

No

The test step.

Test step 1

contentType

string

body

No

The content format. Valid values: TABLE and TEXT.

TEXT

expectedResult

string

body

No

The expected result when contentType is set to TEXT. In a request, pass plain text; the server converts it to rich text for storage. In a response, HTML content is returned.

Expected result 1

stepContent

string

body

No

The test steps when contentType is set to TEXT. In a request, pass plain text; the server converts it to rich text for storage. In a response, HTML content is returned. If this parameter and content are both specified, this parameter takes precedence.

Test step 1

Request examples

Central edition

curl -X 'PUT' \
  'https://{domain}/oapi/v1/testhub/organizations/{organizationId}/testRepos/{testRepoId}/testcases/{id}' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  --data '
    {
        "assignedTo": "user-id-xxx",
        "labels": [
            
        ],
        "preCondition": "The user is registered and logged on",
        "preConditionFormat": "TEXT",
        "subject": "Verify that the logon feature is available",
        "testSteps": {
            "content": [
                {
                    "expected": "Expected result 1",
                    "step": "Test step 1"
                }
            ],
            "contentType": "TEXT",
            "expectedResult": "Expected result 1",
            "stepContent": "Test step 1"
        }
    }'

Region edition

curl -X 'PUT' \
  'https://{domain}/oapi/v1/testhub/testRepos/{testRepoId}/testcases/{id}' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  --data '
    {
        "assignedTo": "user-id-xxx",
        "labels": [
            
        ],
        "preCondition": "The user is registered and logged on",
        "preConditionFormat": "TEXT",
        "subject": "Verify that the logon feature is available",
        "testSteps": {
            "content": [
                {
                    "expected": "Expected result 1",
                    "step": "Test step 1"
                }
            ],
            "contentType": "TEXT",
            "expectedResult": "Expected result 1",
            "stepContent": "Test step 1"
        }
    }'

Response parameters

None.

Error codes

For error codes, see the Error code center.