Obtaining Unit Test Coverage
Function
This API is used to obtain the unit test coverage.
Calling Method
For details, see Calling APIs.
URI
GET /v1/report/{job_id}/{build_no}/coverage/metrics
Parameter | Mandatory | Type | Description |
|---|---|---|---|
job_id | Yes | String | Definition Enter the ID of the build task whose history you want to query. To obtain this ID, open the build history page in your browser, and copy the 32-character string, which includes both digits and letters and appears in the URL immediately after /detail/history/. Constraints N/A Range The value is 32 characters long. Only letters and digits are allowed. Default Value N/A |
build_no | Yes | Integer | Definition The build number tracks each run of the build task. This parameter starts at 1, indicating the first build. It increments by 1 for every subsequent run. Constraints The value is a positive integer. Range Use only numbers that are 1 or greater. Default Value 1 |
Parameter | Mandatory | Type | Description |
|---|---|---|---|
root_id | Yes | String | Resource ID. It is used for downloading coverage reports. |
Request Parameters
Parameter | Mandatory | Type | Description |
|---|---|---|---|
X-Auth-Token | Yes | String | Definition User token. (The value of the X-Subject-Token response header is the user token.) It can be obtained by calling the IAM service API. For details, see Obtaining an IAM User Token. Constraints Global tenant tokens are not supported. Use a region-level token whose scope is project. Range N/A. Default Value N/A. |
Response Parameters
Status code: 200
Parameter | Type | Description |
|---|---|---|
status | String | Definition API response status. Range ● success: The API call is successful. ● fail: The API call failed. |
error | Object | Definition Error message. Range N/A. |
result | String | Definition Data returned after the API is successfully called. Range N/A. |
Example Requests
GET https://{endpoint}/v1/report/{job_id}/{build_no}/coverage/metrics
{
"copy_job_id" : "db8467d972cc47f7a1bd2a3a3e77596a",
"arch" : "x86-64",
"project_id" : "a287e712be6c404ca26e5f69040fa12b",
"job_name" : "examplejob",
"auto_update_sub_module" : "false",
"flavor" : "2u8g",
"parameters" : [ {
"name" : "hudson.model.StringParameterDefinition",
"params" : [ {
"name" : "name",
"value" : "codeBranch"
}, {
"name" : "type",
"value" : "normalparam"
}, {
"name" : "defaultValue",
"value" : "master"
}, {
"name" : "description",
"value" : "description"
}, {
"name" : "deletion",
"value" : "false"
}, {
"name" : "defaults",
"value" : "true"
}, {
"name" : "staticVar",
"value" : "false"
}, {
"name" : "sensitiveVar",
"value" : "false"
} ]
} ],
"scms" : [ {
"branch" : "master",
"url" : "git@codehub.devcloud.cn-north-7.ulanqab.huawei.com:soso-test00001/an.git",
"repo_id" : "2111746211",
"web_url" : "https://codehub.devcloud.cn-north-7.ulanqab.huawei.com/codehub/2111746211/home",
"scm_type" : "codehub",
"is_auto_build" : false,
"build_type" : "branch",
"depth" : "1"
} ],
"steps" : [ {
"properties" : null,
"module_id" : "devcloud2018.codeci_action_20043.action",
"name" : "Build with Maven",
"version" : "20231001.6",
"enable" : true
} ],
"host_type" : "devcloud",
"triggers" : [ {
"name" : "hudson.triggers.TimerTrigger",
"parameters" : [ {
"name" : "spec",
"value" : "18 15 * * 1,2,3,4,5"
}, {
"name" : "timeZoneId",
"value" : "Asia/Shanghai"
}, {
"name" : "timeZone",
"value" : "China_Standard_Time"
}, {
"name" : "isDST",
"value" : "false"
} ]
} ]
} Example Responses
Status code: 200
OK
{
"status" : "success",
"error" : null,
"result" : ""
} Status Codes
Status Code | Description |
|---|---|
200 | OK |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot
