用例库中创建测试用例
接口说明
用例库中创建测试用例,填写的人员信息必须要使用 aliyunPk
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
授权信息
当前API暂无授权信息透出。
请求语法
POST /organization/{organizationId}/testhub/testcase
请求参数
| 名称 | 类型 | 必填 | 描述 | 示例值 | 
|---|---|---|---|---|
| organizationId | string | 是 | 企业标识,也称企业 id,字符串形式,可在云效访问链接中获取,如 https://devops.aliyun.com/organization/【OrganizationId】 | 5ebbc0228123212b59xxxxx | 
| body | object | 否 | 请求 Body | |
| subject | string | 是 | 测试用例标题 | 测试工作项 | 
| assignedTo | string | 是 | 负责人 id | 19xxxx31947xxxx | 
| spaceIdentifier | string | 是 | 用例库 id | asd345xxxxx9q9845xxxxx34 | 
| directoryIdentifier | string | 是 | 目录 id | fdd395xxxxx9q9845xxxxx23 | 
| priority | string | 否 | 用例优先级 | ik3dexxxxxfdfds1xxxxx23 | 
| tags | array | 否 | 标签 id 数组 | |
| string | 否 | 标签唯一标识,标签 id | ||
| fieldValueList | array<object> | 否 | 自定义字段列表 | |
| object | 否 | 需要先通过获取工作项字段的接口:ListTestCaseAllFields 查看哪些字段是必填,isRequired 为 true 的则为必填。 | ||
| fieldIdentifier | string | 否 | 字段 id | 6aexxxxxa1d98c09c60xxxx16 | 
| value | string | 否 | 字段值 | 77c7fb03c4186c8691d6... | 
| testcaseStepContentInfo | object | 否 | 测试用例步骤内容信息 | |
| precondition | string | 否 | 前置条件 | 前置条件内容 | 
| stepType | string | 是 | 测试步骤格式,只有表格和文本两种形式 枚举值: 
 | TEXT | 
| stepResultList | array<object> | 否 | 测试用例步骤与内容,如果该内容为文本形式,则 stepResultList 只会取第一组值,并且可以给步骤内容和预期结果设置格式;如果该内容为表格形式,则会取到每一组步骤和内容值,但是无法设置步骤内容和预期结果的格式。 | |
| object | 否 | step 为测试步骤,expected 为预期结果 | ||
| step | string | 否 | 测试步骤 | 测试第一步骤 | 
| expected | string | 否 | 测试内容 | 测试第一步预期结果 | 
返回参数
示例
正常返回示例
JSON格式
{
  "requestId": "18E50717-93A4-53BC-A30D-963F742A1CE6",
  "errorMsg": "error",
  "errorCode": "\"\"",
  "success": true,
  "testcase": {
    "identifier": "5a73f81c834d013361d92bdcce",
    "subject": "标题",
    "assignedTo": {
      "assignIdentifier": "134xxx343xxxxx",
      "name": "人员名称",
      "tbRoleId": "3c2253c22xxxxxxxx53a"
    },
    "spaceIdentifier": "a18571eba8fe9267cd8375fc06",
    "spaceType": "TestRepo\n\n",
    "categoryIdentifier": "TestCase\n\n",
    "creator": {
      "createIdentifier": "134xxx343xxxxx",
      "name": "人员名称"
    },
    "modifier": {
      "modifyIdentifier": "134xxx343xxxxx",
      "name": "人员名称"
    },
    "directory": {
      "directoryIdentifier": "0bc1150dcxxxxxxxx04c",
      "name": "全部目录",
      "pathName": [
        "[一级目录,二级目录]"
      ],
      "childIdentifier": "0bc1150dcxxxxxxxx04c"
    },
    "detailInfo": {
      "stepType": "TEXT/TABLE",
      "precondition": {
        "preIdentifier": "59253164xxxxxxf2e98dbc7e27",
        "preContent": "前置条件内容",
        "preContentType": "RICHTEXT"
      },
      "stepContent": {
        "stepIdentifier": "59253164xxxxxxf2e98dbc7e27",
        "stepContent": "测试步骤内容",
        "stepContentType": "RICHTEXT"
      },
      "expectedResult": {
        "expectIdentifier": "59253164xxxxxxf2e98dbc7e27",
        "expectContent": "预期结果",
        "expectContentType": "RICHTEXT"
      }
    }
  }
}错误码
| HTTP status code | 错误码 | 错误信息 | 描述 | 
|---|---|---|---|
| 400 | Openapi.RequestError | request error | OpenAPI请求数据错误 | 
| 403 | Operate.NoPermission | NoPermission | 没有权限 | 
访问错误中心查看更多错误码。
变更历史
| 变更时间 | 变更内容概要 | 操作 | 
|---|
暂无变更历史
