Zadig 文档
Zadig
教程
博客
论坛
关于
中文英文
Zadig
教程
博客
论坛
关于
Zadig v5.0
Loading...
     编辑文档
     反馈问题
     社区讨论

    本页导航

    测试

    # 执行测试任务

    请求

    POST /openapi/quality/testing/task
    
    1

    Body 参数说明

    参数名说明类型必填
    project_key项目标识string是
    test_name测试名称string是
    repo_info代码库运行时配置,未指定时使用测试配置中的默认值[]RepoInfo否
    inputs运行时变量,未指定的变量使用测试配置中的默认值[]Input否

    RepoInfo 参数说明

    参数名说明类型必填
    codehost_name代码源名称string是
    repo_namespace代码库所属命名空间(组织/个人)string是
    repo_name代码库名称string是
    branch分支名称,enable_commit 为 false 时必填string否
    prPull Request 编号int否
    prsPull Request 编号列表[]int否
    enable_commit是否使用指定 Commitbool否
    commit_idCommit ID,enable_commit 为 true 时必填string否

    repo_info 中的代码库必须已配置在该测试中,不支持覆盖 Perforce 代码库。

    Input 参数说明

    参数名说明类型必填
    key变量名称,必须已配置在该测试中string是
    value变量值string否
    type变量类型string否
    is_credential是否为敏感变量bool否
    file_id文件 IDstring否
    file_name文件名称string否
    file_path文件路径string否

    Body 参数示例

    {
        "project_key": "demo",
        "test_name": "test-demo",
        "repo_info": [
            {
                "codehost_name": "github",
                "repo_namespace": "koderover",
                "repo_name": "zadig",
                "branch": "main"
            }
        ],
        "inputs": [
            {
                "key": "ENV",
                "value": "test"
            }
        ]
    }
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18

    成功返回

    参数名类型描述
    task_idint测试任务 ID
    {
      "task_id": 27
    }
    
    1
    2
    3

    失败返回

    {
        "code": 500,
        "description": "mongo: no documents in result",
        "message": "Internal Error: "
    }
    
    1
    2
    3
    4
    5

    # 获取测试变量

    获取测试的运行时变量定义。敏感变量的 value 不会返回,可通过 has_value 判断是否已配置值。

    请求

    GET /openapi/quality/testing/:testName?projectKey=<项目标识>
    
    1

    路径参数说明

    参数名类型描述必填
    testNamestring测试名称是

    Query 参数说明

    参数名类型描述必填
    projectKeystring项目标识是

    成功返回说明

    参数名类型描述
    project_keystring项目标识
    test_namestring测试名称
    inputs[]TestInput运行时变量定义

    TestInput 参数说明

    参数名类型描述
    keystring变量名称
    valuestring默认值,敏感变量不返回该字段
    typestring变量类型
    choice_option[]string可选值列表
    requiredbool是否必填
    is_credentialbool是否为敏感变量
    has_valuebool是否已配置值
    descriptionstring变量描述

    成功返回示例

    {
        "project_key": "demo",
        "test_name": "test-demo",
        "inputs": [
            {
                "key": "ENV",
                "value": "test",
                "type": "choice",
                "choice_option": [
                    "test",
                    "production"
                ],
                "required": true,
                "is_credential": false,
                "has_value": true,
                "description": "运行环境"
            },
            {
                "key": "PASSWORD",
                "type": "string",
                "required": true,
                "is_credential": true,
                "has_value": true
            }
        ]
    }
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26

    # 获取测试任务详情

    请求

    GET /openapi/quality/testing/:testName/task/:taskID?projectKey=<项目标识>
    
    1

    路径参数说明

    参数名类型描述必填
    testNamestring测试名称是
    taskIDint测试任务 ID是

    Query 参数说明

    参数名类型描述必填
    projectKeystring项目标识是

    成功返回说明

    参数名类型描述
    test_name测试名称string
    task_id测试任务 IDint
    creator创建者string
    create_time创建时间int
    start_time任务开始执行时间int
    end_time任务结束执行时间int
    status当前状态:
    created:测试任务已创建
    running:测试任务正在执行
    passed:测试任务执行通过
    skipped:测试任务未执行跳过
    failed:测试任务执行失败
    timeout:测试任务执行超时
    cancelled:测试任务已取消
    waiting:测试任务等待执行
    queued:测试任务已加入执行队列中
    string
    test_report测试报告Report

    Report 参数说明

    参数名类型描述
    test_total总测试用例数量int
    failure_total失败测试用例数量int
    success_total成功测试用例数量int
    skiped_total未执行测试用例数量int
    error_total错误测试用例数量int
    test_cases测试用例列表[]TestCase

    TestCase 参数说明

    参数名类型描述
    name用例名称string
    time用时,单位 秒int
    failure失败信息Message
    skipped未执行信息空结构体,该值为 null 代表此测试用例已执行,否则返回空结构体
    error错误信息Message

    Message 参数说明

    参数名类型描述
    message错误消息摘要string
    type类型string
    text错误具体内容string

    成功返回示例

    {
        "test_name": "test-demo",
        "task_id": 16,
        "creator": "cici",
        "create_time": 1689823467,
        "start_time": 1689823470,
        "end_time": 1689823491,
        "status": "passed",
        "test_report": {
            "test_total": 24,
            "failure_total": 0,
            "success_total": 24,
            "skiped_total": 0,
            "error_total": 0,
            "time": 13.872,
            "test_type": "",
            "name": "",
            "test_cases": [
                {
                    "name": "e2e Test Suites Scenario 1 - 现有项目的回归测试 被测试环境中存在一个叫做voting的项目 可以查看环境",
                    "time": 0.155922912,
                    "failure": null,
                    "skipped": null,
                    "error": null
                },
                
                {
                    "name": "e2e Test Suites Scenario 1 - 现有项目的回归测试 被测试环境中存在一个叫做voting的项目 可以查看Voting项目信息",
                    "time": 0.136967508,
                    "failure": null,
                    "skipped": null,
                    "error": null
                },
                {
                    "name": "e2e Test Suites Scenario 2 - onboarding的核心流程 经过系统的onboarding流程,自动生成了环境和一些工作流 成功的自动创建了环境和工作流,工作流可以被触发",
                    "time": 7.83081332,
                    "failure": null,
                    "skipped": null,
                    "error": null
                }
            ]
        }
    }
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43

    失败返回

    {
        "code": 500,
        "description": "failed to get pipeline task from db, taskID:1, pipelineName:tt-job, err: mongo: no documents in result",
        "message": "Internal Error: "
    }
    
    1
    2
    3
    4
    5

    ← 构建代码扫描→

    资源
    教程
    论坛
    博客
    公司
    关于
    客户故事
    加入我们
    联系我们
    微信扫一扫
    hello@koderover.com

    © 2026 筑栈(上海)信息技术有限公司 沪 ICP 备 19000177 号 - 1

    •  跟随系统
    •  浅色模式
    •  深色模式
    •  阅读模式