理解“通知” 中的 Webhook包含的负载
Testany 通知系统将使用以下数据格式通过 webhook 分发通知对方。
表 1:负载请求的基本信息
| HTTP 版本 | HTTP/1.1 | 
| 请求方法 | POST,符合 RFC2616 | 
| TLS 验证 | 严格,如果提供 | 
| MIME 类型 | 
 | 
| 超时 | 15 秒 | 
| 重试 | 3 次 | 
| 主体 | 见表 2 | 
表 2:负载主体数据格式
| 键 | 类型 | 说明 | 示例 | 
|---|---|---|---|
| 
 | 字符串 | 触发器的名称。 | 
 | 
| 
 | 整数 | 触发器执行状态: | 
 | 
| 
 | 字符串 | 触发器的键。 | 
 | 
| 
 | 字符串,枚举 | 指示触发器的类型。枚举: | 
 | 
| 
 | []字符串 | 触发器资源所有者的列表。 | 
 | 
| 
 | []管道 | 执行的管道列表。 | 见表 3 | 
表 3:管道数据格式
| 键 | 类型 | 说明 | 示例 | 
|---|---|---|---|
| 
 | 字符串 | 管道的名称 | 
 | 
| 
 | 整数 | 管道执行状态: | 
 | 
| 
 | 字符串 | 管道的键。 | 
 | 
| 
 | []字符串 | 管道所有者的列表。 | 
 | 
| 
 | []案例 | 管道使用的案例执行结果列表。 | 见表 4 | 
| 
 | 整数 | 管道执行的持续时间,单位为  | 
 | 
| 
 | 字符串 | 管道执行标识符。 | 
 | 
| 
 | 字符串,时间戳 | RFC3339 时间戳,指示管道执行的开始时间。 | 
 | 
| 
 | 字符串,时间戳 | RFC3339 时间戳,指示管道执行的结束时间。 | 
 | 
表 4:案例数据格式
| 键 | 类型 | 说明 | 示例 | 
|---|---|---|---|
| 
 | 字符串 | 测试案例的名称 | 
 | 
| 
 | 整数 | 测试案例执行状态: | 
 | 
| 
 | 字符串 | 测试案例的键。 | 
 | 
| 
 | 字符串 | 执行案例的运行时实例的唯一标识符。 | 
 | 
| 
 | 字符串 | 执行案例的运行时实例的唯一名称。 | 
 | 
| 
 | []字符串 | 测试案例所有者的列表。 | 
 | 
| 
 | 整数 | 测试案例执行的持续时间,单位为  | 
 | 
| 
 | 字符串 | 测试案例的环境。 | 
 | 
| 
 | 字符串,时间戳 | RFC3339 时间戳,指示测试案例执行的开始时间。 | 
 | 
| 
 | 字符串,时间戳 | RFC3339 时间戳,指示测试案例执行的结束时间。 | 
 | 
示例
计划任务执行结果通知样例
{
  "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"
  ]
}门卫执行结果通知样例
{
  "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"
  ]
}
