Create Quality Gate profile API in Test Reporting & Analytics
Use this API to create a Quality Gate profile programmatically and automate workflows.
To learn more about Quality Gate, read further here..
Create Quality Gate profile
Request parameters
Request
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X POST \
-H "Content-Type: application/json" \
--data '{
"name": "quality-profile-1",
"enabled": true,
"isGlobalProfile": true,
"applicableBuilds": {
"allBuilds": true,
"buildTags": ["p1"],
"buildNames": ["build-A"]
},
"ruleStatus": "pass",
"hooksVisibility": "failed",
"rules": [
{
"id": "uuid()",
"type": "TEST_STATUS",
"operator": "has",
"lhs": {
"value": "ALL_TESTS",
"helperConfig": {
"testTags": ["p1", "p2"],
"folder": ["folderA", "folderB"]
}
},
"rhs": {
"value": "passed",
"type": "string"
}
},
{
"id": "uuid()",
"type": "TEST_STATUS_THRESHOLD",
"operator": "greater_than_equals",
"lhs": {
"value": "OVERALL_BUILD",
"helperConfig": {
"testTags": ["p1", "p2"],
"folder": ["folderA", "folderB"]
},
"with": "passed"
},
"rhs": {
"value": 50,
"type": "percent"
}
},
{
"id": "uuid()",
"type": "STABILITY",
"operator": "greater_than_or_equal_to",
"lhs": {
"value": "OVERALL_BUILD",
"helperConfig": {
"testTags": ["p1", "p2"],
"folder": ["folderA", "folderB"]
}
},
"rhs": {
"value": "12.27",
"type": "percentage"
}
},
{
"id": "uuid()",
"type": "TEST_EXECUTIONS_THRESHOLD",
"operator": "greater_than",
"lhs": {
"value": "OVERALL_BUILD",
"helperConfig": {
"testTags": ["p1", "p2"],
"folder": ["folderA", "folderB"]
}
},
"rhs": {
"value": "12000",
"type": "number"
}
},
{
"id": "uuid()",
"type": "SMART_TAGS",
"operator": "is",
"lhs": {
"value": "any_tests",
"helperConfig": {
"testTags": ["p1", "p2"],
"folder": ["folderA", "folderB"]
},
"with": "isFlaky"
},
"rhs": {
"value": null,
"type": null
}
},
{
"id": "uuid()",
"type": "SMART_TAGS_THRESHOLD",
"operator": "less_than",
"lhs": {
"value": "OVERALL_BUILD",
"helperConfig": {
"testTags": ["p1", "p2"],
"folder": ["folderA", "folderB"]
},
"with": "isFlaky"
},
"rhs": {
"value": "10",
"type": "percent"
}
},
{
"id": "uuid()",
"type": "ALERTS",
"operator": "triggered",
"lhs": {
"value": "any_alerts",
"helperConfig": {
"alert": {
"id": "123",
"name": "alert1"
}
}
},
"rhs": {
"value": "CRITICAL",
"type": "string"
}
},
{
"id": "uuid()",
"type": "FAILURE_CATEGORY",
"operator": "is",
"lhs": {
"value": "any_test",
"helperConfig": {
"tests": ["t1", "t2"]
},
"with": "Automation Bug"
},
"rhs": {
"value": null,
"type": null
}
},
{
"id": "uuid()",
"type": "FAILURE_CATEGORY_THRESHOLD",
"operator": "greater_than",
"lhs": {
"value": "OVERALL_BUILD",
"helperConfig": {
"testTags": ["p1", "p2"],
"folder": ["folderA", "folderB"]
},
"denominator": "total",
"with": "automationBug"
},
"rhs": {
"value": "10",
"type": "percent"
}
},
{
"id": "uuid()",
"type": "NEW_UNIQUE_ERROR",
"operator": "is",
"lhs": {
"value": "any_test",
"helperConfig": {
"testTags": ["p1", "p2"],
"folder": ["folderA", "folderB"]
}
},
"rhs": {
"value": "10",
"type": "number"
}
},
{
"id": "uuid()",
"type": "UNIQUE_ERROR_THRESHOLD",
"operator": "less_than",
"lhs": {
"value": null,
"helperConfig": {},
"with": "should_be"
},
"rhs": {
"value": "10",
"type": "number"
}
}
]
}' \
https://api-automation.browserstack.com/ext/v1/quality-gates/{normalized project name}/profiles
-
name* String
Name of the Quality Gate profile.
-
enabled* Boolean
Indicates whether the Quality Gate profile is enabled or disabled.
-
isGlobalProfile* Boolean
Indicates whether the Quality Gate profile is global or local.
-
applicable_builds Object
List of applicable builds for the quality gate profile.
-
ruleStatus String
Status of the rule. Possible values are “pass”, “fail”.
-
hooksVisibility String
Which type of hooks should be treated as tests. Possible values are “failed”, “none”, “beforeFailed”, and “all”.
-
rules* Object
List of rules for the quality gate profile. It is an array of objects.
Response Attributes 200 OK
JSON
Response
{
"success": true,
"uuid": "48c33305-ab69-4525-bdcb-b88d1ee06f0e" // profile uuid
}
-
success Boolean
Denotes whether the Quality Gate profile was created successfully.
-
uuid String
The unique identifier of the Quality Gate profile created.
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.