Skip to main content
Skip table of contents

理解“通知” 中的 Webhook包含的负载

Testany 通知系统将使用以下数据格式通过 webhook 分发通知对方。

表 1:负载请求的基本信息

HTTP 版本

HTTP/1.1

请求方法

POST,符合 RFC2616

TLS 验证

严格,如果提供

MIME 类型

application/json

超时

15 秒

重试

3 次

主体

见表 2

表 2:负载主体数据格式

类型

说明

示例

name

字符串

触发器的名称。

"notification-demo-payload"

status

整数

触发器执行状态:1 成功 2 失败

1

trigger_key

字符串

触发器的键。

"P-ABC-0001"

trigger_method

字符串,枚举

指示触发器的类型。枚举:plan gatekeeper

"plan"

trigger_owner

[]字符串

触发器资源所有者的列表。

["john.doe@acme.tld"]

pipelines

[]管道

执行的管道列表。

见表 3

表 3:管道数据格式

类型

说明

示例

name

字符串

管道的名称

"demo-for-event"

status

整数

管道执行状态:1 成功 2 失败

1

key

字符串

管道的键。

"ABC-0001"

owner

[]字符串

管道所有者的列表。

["john.doe@acme.tld"]

cases

[]案例

管道使用的案例执行结果列表。

见表 4

duration

整数

管道执行的持续时间,单位为

22

execution_key

字符串

管道执行标识符。

"ABC-0001-033CE"

start_time

字符串,时间戳

RFC3339 时间戳,指示管道执行的开始时间。

"2006-01-02T15:04:05Z"

finish_time

字符串,时间戳

RFC3339 时间戳,指示管道执行的结束时间。

"2006-01-02T15:04:05Z"

表 4:案例数据格式

类型

说明

示例

name

字符串

测试案例的名称

"check-notification-active"

status

整数

测试案例执行状态:1 通过 2 失败 3 跳过 4 预期失败

1

key

字符串

测试案例的键。

"00000000"

runtime_uuid

字符串

执行案例的运行时实例的唯一标识符。

"00000000-0000-0000-0000-000000000000"

runtime_name

字符串

执行案例的运行时实例的唯一名称。

"CloudPrime-Default"

owner

[]字符串

测试案例所有者的列表。

["john.doe@acme.tld"]

duration

整数

测试案例执行的持续时间,单位为

6

env

字符串

测试案例的环境。

"DEMO"

start_time

字符串,时间戳

RFC3339 时间戳,指示测试案例执行的开始时间。

"2006-01-02T15:04:05Z"

finish_time

字符串,时间戳

RFC3339 时间戳,指示测试案例执行的结束时间。

"2006-01-02T15:04:05Z"

示例

计划任务执行结果通知样例

JSON
{
  "name": "notification-demo-payload",
  "pipelines": [
    {
      "cases": [
        {
          "duration": 6,
          "env": "DEMO",
          "finish_time": "2006-01-02T15:04:05Z",
          "key": "00000000",
          "name": "check-notification-active",
          "owner": [
            "john.doe@acme.tld"
          ],
          "start_time": "2006-01-02T15:04:05Z",
          "status": 1,
          "runtime_uuid": "00000000-0000-0000-0000-000000000000",
          "runtime_name": "CloudPrime-Default"
        }
      ],
      "duration": 22,
      "execution_key": "ABC-0001-033CE",
      "finish_time": "2006-01-02T15:04:05Z",
      "key": "ABC-0001",
      "name": "demo-for-event",
      "owner": [
        "john.doe@acme.tld"
      ],
      "start_time": "2006-01-02T15:04:05Z",
      "status": 1
    }
  ],
  "status": 1,
  "trigger_key": "P-ABC-0001",
  "trigger_method": "plan",
  "trigger_owner": [
    "john.doe@acme.tld"
  ]
}

门卫执行结果通知样例

JSON
{
  "name": "notification-demo-payload",
  "pipelines": [
    {
      "cases": [
        {
          "duration": 6,
          "env": "DEMO",
          "finish_time": "2006-01-02T15:04:05Z",
          "key": "00000000",
          "name": "check-notification-active",
          "owner": [
            "john.doe@acme.tld"
          ],
          "start_time": "2006-01-02T15:04:05Z",
          "status": 1,
          "runtime_uuid": "00000000-0000-0000-0000-000000000000",
          "runtime_name": "CloudPrime-Default"
        }
      ],
      "duration": 22,
      "execution_key": "ABC-0001-033CE",
      "finish_time": "2006-01-02T15:04:05Z",
      "key": "ABC-0001",
      "name": "demo-for-event",
      "owner": [
        "john.doe@acme.tld"
      ],
      "start_time": "2006-01-02T15:04:05Z",
      "status": 1
    }
  ],
  "status": 1,
  "trigger_key": "G-ABC-0001",
  "trigger_method": "gatekeeper",
  "trigger_owner": [
    "john.doe@acme.tld"
  ]
}

 

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.