Help Center/ CodeArts PerfTest/ API Reference/ API/ Case Management/ Modifying a Case (Old Edition)
Updated on 2024-01-10 GMT+08:00

Modifying a Case (Old Edition)

Function

This API is used to modify a case on the old UI.

URI

PUT /v1/{project_id}/task-cases/{case_id}/target/{target}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details, see Obtaining a Project ID.

Minimum: 0

Maximum: 64

case_id

Yes

Integer

Case ID.

Minimum: 0

Maximum: 2147483647

target

Yes

String

Case type.

Minimum: 0

Maximum: 64

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

case_id

No

Integer

Case ID.

Minimum: 0

Maximum: 2147483647

name

No

String

Case name.

Minimum: 0

Maximum: 1024

case_type

No

Integer

Case type (0: normal case).

Minimum: 0

Maximum: 2147483647

contents

No

Array of Contents objects

Case script information.

Array Length: 0 - 1024

for_loop_params

No

Array of objects

Logic controller field of the old edition. This parameter is not used in the current edition.

Array Length: 0 - 10240

increase_setting

No

Array of objects

Gradient increment.

Array Length: 0 - 10240

stages

No

Array of TestCaseStage objects

Phase information.

Array Length: 0 - 1024

status

No

Integer

Status (0: deleted; 1: enabled; 2: disabled).

Minimum: 0

Maximum: 2147483647

temp_id

No

Integer

Case ID.

Minimum: 0

Maximum: 2147483647

sort

No

Integer

Sorting field.

directory_id

No

Integer

Directory ID of the case. This parameter is optional for APIs of earlier versions.

Minimum: 0

Maximum: 2147483647

setup_contents

No

Array of Contents objects

Preparations.

user_replicas

No

Integer

Actuators.

Minimum: 0

Maximum: 2147483647

collect_log_policy

No

Integer

Log collection policy (0: request mode; 1: case mode).

Minimum: 0

Maximum: 32

link_app_list

No

Array of integers

Associated full-link application list.

case_info

No

CaseDoc object

Text case information.

Table 3 TestCaseStage

Parameter

Mandatory

Type

Description

operate_mode

No

Integer

Pressure phase mode (0: by duration; 1: by count).

name

No

String

Phase name.

time

No

Integer

Duration, in seconds.

start_time

No

Integer

Start time.

end_time

No

Integer

End time.

issue_num

No

Integer

Maximum concurrency.

count

No

Integer

Total transmission times.

pressure_mode

No

Integer

Pressure mode (0: concurrent mode; 1: TPS mode; 2: high pressure mode; 3: surge concurrency mode; 4: surge TPS mode; 5: flapping concurrency mode; 6: flapping TPS mode; 7: intelligent high pressure mode).

tps_value

No

Integer

TPS value in TPS mode.

current_user_num

No

Integer

Start concurrency.

current_tps

No

Integer

Start TPS value.

voltage_regulating_mode

No

Integer

Pressure adjustment mode (0: automated; 1: manual).

maximum

No

Integer

Maximum concurrency in the surge mode.

minimum

No

Integer

Minimum concurrency in the surge mode.

loop_count

No

Integer

Oscillation/surge times.

max_duration

No

Integer

Peak duration in the surge mode.

ramp_up

No

Integer

Ramp up (in seconds) in the peakload mode.

peak_load_kpis

No

StageKpiItems object

Expected KPI.

step_duration

No

Integer

Single-step execution duration in the intelligent peakload mode.

step_size

No

Integer

Increase concurrency in the intelligent peakload mode.

Table 4 StageKpiItems

Parameter

Mandatory

Type

Description

average_response_time

No

StageKpiItem object

Average response time.

success_rate

No

StageKpiItem object

Success rate.

Table 5 StageKpiItem

Parameter

Mandatory

Type

Description

comparison

No

String

Comparison operator.

value

No

Integer

Comparison value.

Table 6 Contents

Parameter

Mandatory

Type

Description

content_id

No

Integer

Transaction ID. If the transaction ID is not 0, the card is a transaction. If it is 0, the card is not a transaction.

Minimum: 0

Maximum: 2147483647

content

No

Array of Content objects

Content.

Array Length: 0 - 1000

index

No

Integer

Sorting index.

Minimum: 0

Maximum: 2147483647

selected_temp_name

No

String

Name of the selected transaction or case.

Minimum: 0

Maximum: 40960

data

No

Object

Data to which the loop and condition controller apply.

data_type

No

Integer

Type (0: default request; 1: data instruction; 201: cycle instruction; 202: condition instruction; 301: rendezvous point).

Minimum: 0

Maximum: 2147483647

conditions

No

Object

If the type is 202 (condition instruction), this field configures the condition.

is_disabled

No

Boolean

Whether to disable the AW.

Table 7 Content

Parameter

Mandatory

Type

Description

content_type

No

Integer

Case card type (1: think time; 2: packet; 3: checkpoint; 4: variable extraction).

Minimum: 0

Maximum: 2147483647

content

No

ContentInfo object

Content.

Table 8 ContentInfo

Parameter

Mandatory

Type

Description

body_type

No

Integer

Body type (0: string; 1: form-data format; 3: x-www-form-urlencoded format).

Minimum: 0

Maximum: 2147483647

bodys

No

Array of objects

bodys

check_end_length

No

Object

Length of the data returned through TCP/UDP.

check_end_str

No

Object

End character returned through TCP/UDP.

check_end_type

No

Object

End type (1: data length; 2: end character) returned through TCP/UDP.

connect_timeout

No

Integer

Timeout duration.

Minimum: 0

Maximum: 2147483647

connect_type

No

Integer

Connection settings. This parameter is not used in the current edition.

Minimum: 0

Maximum: 2147483647

headers

No

Array of ContentHeader objects

Request header.

Array Length: 0 - 1024

http_version

No

String

HTTP version.

Minimum: 0

Maximum: 1024

method

No

String

HTTP method.

Minimum: 0

Maximum: 1024

name

No

String

Case name.

Minimum: 0

Maximum: 1024

protocol_type

No

Integer

Protocol type (1: HTTP; 2: HTTPS; 3: TCP; 4: UDP; 7: HLS/RTMP; 9: WebSocket; 10: HTTP-FLV).

Minimum: 0

Maximum: 2147483647

return_timeout

No

Integer

Response timeout.

Minimum: 0

Maximum: 2147483647

return_timeout_param

No

String

Response timeout parameter.

Minimum: 0

Maximum: 40960

url

No

String

Request URL.

Minimum: 0

Maximum: 40960

rtmp_url

No

String

RTMP address.

Minimum: 0

Maximum: 40960

flv_url

No

String

FLV address.

Minimum: 0

Maximum: 40960

bitrate_type

No

Integer

Resolution policy.

Minimum: 0

Maximum: 128

duration

No

Integer

Duration.

Minimum: 0

Maximum: 2147483647

retry_delay

No

Integer

HLS retry delay.

Minimum: 0

Maximum: 2147483647

retry_time

No

Integer

HLS retries.

Minimum: 0

Maximum: 2147483647

Table 9 ContentHeader

Parameter

Mandatory

Type

Description

key

No

String

Key.

Minimum: 0

Maximum: 40960

value

No

String

Value.

Minimum: 0

Maximum: 40960

Table 10 CaseDoc

Parameter

Mandatory

Type

Description

description

No

String

Case description.

Minimum: 0

Maximum: 2147483647

label_names

No

Array of strings

Tags.

preparation

No

String

Preparations.

Minimum: 0

Maximum: 2147483647

rank

No

Integer

Case level (0: L0, 1: L1, 2: L2, 3: L3, 4: L4).

Minimum: 0

Maximum: 64

status_code

No

Integer

Status (0: new; 5: designing; 6: testing; 7: completed).

steps

No

Array of steps objects

Procedure.

Table 11 steps

Parameter

Mandatory

Type

Description

expect_result

No

String

Step description.

Minimum: 0

Maximum: 2147483647

test_step

No

String

Expected result.

Minimum: 0

Maximum: 2147483647

Response Parameters

None

Example Requests

  • Modifying a case by adding a request to it.

    /v1/projectId/task-cases/caseId/target/content
    
    {
      "contents" : [ {
        "content_id" : 0,
        "content" : [ {
          "content_type" : 2,
          "content" : {
            "body_type" : 0,
            "bodys" : [ ],
            "check_end_length" : null,
            "check_end_str" : null,
            "check_end_type" : null,
            "connect_timeout" : 5000,
            "connect_type" : 1,
            "headers" : [ {
              "key" : "Content-Type",
              "value" : "application/json"
            } ],
            "http_version" : "HTTP/1.1",
            "method" : "GET",
            "name" : "Msg-24642",
            "protocol_type" : 1,
            "return_timeout" : 5000,
            "return_timeout_param" : null,
            "url" : "http://1.1.1.1"
          }
        } ],
        "index" : 0,
        "selected_temp_name" : "",
        "data" : null,
        "data_type" : 0,
        "conditions" : null,
        "is_disabled" : false
      } ],
      "for_loop_params" : [ ]
    }
  • Modifying a case by adding a pressure phase to it.

    /v1/projectId/task-cases/caseId/target/stage
    
    {
      "increase_setting" : [ ],
      "stages" : [ {
        "count" : 1,
        "current_user_num" : 10,
        "issue_num" : 10,
        "name" : "Stage-teeb",
        "operate_mode" : 0,
        "pressure_mode" : 0,
        "time" : 60,
        "tps_value" : 1,
        "voltage_regulating_mode" : 0,
        "maximum" : 3,
        "minimum" : 1,
        "loop_count" : 2,
        "max_duration" : 30,
        "step_size" : 1,
        "step_duration" : 30,
        "ramp_up" : 30,
        "peak_load_kpis" : {
          "average_response_time" : {
            "comparison" : "<=",
            "value" : 60000
          },
          "success_rate" : {
            "comparison" : ">=",
            "value" : 0
          }
        }
      } ]
    }
  • Modifying a case by changing its name to testCase.

    /v1/projectId/task-cases/caseId/target/name
    
    {
      "name" : "testCase"
    }

Example Responses

None

Status Codes

Status Code

Description

202

success

501

unknown error

Error Codes

See Error Codes.