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 task details page in your browser, and copy the 32-character string, which includes both digits and letters, at the end of the URL. 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 is obtained by calling the IAM 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. |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
Status code: 401
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
Status code: 403
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
Status code: 404
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
Example Requests
POST https://{endpoint}/v1/job/copy { "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.{region}-7.huawei.com:soso-test00001/an.git", "repo_id" : "2111746211", "web_url" : "https://codehub.devcloud.{region}-7.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 |
400 |
Bad Request |
401 |
Unauthorized |
403 |
Forbidden |
404 |
Not Found |
500 |
Internal Server Error |
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