Execute tests
Allows you to trigger test suite and get build status.
Trigger test suite
Triggers a test suite based on the specified test suite ID.
Request parameters
In the curl request, replace the YOUR_USERNAME
and YOUR_ACCESS_KEY
variables with your account’s username and access-key.
Request
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X POST "https://lcnc-api.browserstack.com/api/v1/test-suite/TEST_SUITE_ID/run" \
-H "Content-Type: application/json" \
-d "{\"base_url\":\" https://www.browserstack.com/\"}"
-
test_suite_id* string
Unique identifier of the test suite. Replace
test_suite_id
in the request path with the ID of the test suite you want to trigger. To get the test suite ID, open the test suite, click View metadata dropdown, and copy the Test suite ID. The response returns a JSON object containing thebuild_id
, which you can use to fetch the test suite execution status. -
base_url string
Base URL to be used for executing the test suite. When a test suite is triggered with
base_url
in the above API, all the tests in that suite will override their existing base URLs with this one during execution.
Response attributes 200
application/json
Response
{
"build_id" : "315d0cfdf7d77a42243ff87c0d6764cc8d3f9b09",
"build_name" : "Smoke Suite-1",
"test_suite_details": {
"test_suite_id" : "315d0cfdf7d77a42243ff87c0d6764cc8d3f9b09",
"name" : "Smoke Suite",
"description" : "Contains P0, P1 cases for Home page",
"execution_browsers" : ["chrome", "firefox", "edge", "safari"],
"host_url" : "",
"local" : false,
"tests" : [
{
"test_id" : "315d0cfdf7d77a42243ff87c0d6764cc8d3f9b09",
"name" : "Sample Test 01 | Buy iPhone 14 on apple",
"url" : "https://apple.com"
},
{
"test_id" : "315d0cfdf7d77a42243ff87c0d6764cc8d3fj38j",
"name" : "Sample Test 02 | Bstackdemo add to cart",
"url" : "https://bstackdemo.com"
}
]
}
}
Fetch build status
Fetches the build status based on the specified build ID. You can get the build ID using the Trigger test suite endpoint.
Request parameters
In the curl request, replace the YOUR_USERNAME
and YOUR_ACCESS_KEY
variables with your account’s username and access-key.
Request
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" -X GET "https://lcnc-api.browserstack.com/api/v1/builds/{build_id}/status"
-
build_id* string
Unique identifier of the test build. Replace
build_id
in the request path with build_id value you receive from the Trigger test suite API.
Response attributes 200
application/json
Response
{
"build_status": "passed",
"triggered_by" : "demo_user@example.com", // "scheduler" in case triggered by scheduler
"triggered_at" : "2024-03-07T07:36:02.695Z",
"build_execution_summary": {
"total": 12,
"passed": 8,
"failed": 4,
"running": 0,
"queued": 0,
"duration" : 1200
},
"build_details": {
"build_id": "315d0cfdf7d77a42243ff87c0d6764cc8d3f9b09",
"build_name": "Smoke Suite-1",
"test_executions": [
{
"test_id": "315d0cfdf7d77a42243ff87c0d6764cc8d3fj38j",
"name": "Sample Test 02 | Bstackdemo add to cart",
"url": "https://bstackdemo.com",
"test_execution_id": "315d0cfdf7d77a42243ff87c0d6764cc8d3fj38j",
"device_config": {
"type" : "desktop",
"browser" : "chrome",
"browser_version" : "102.0",
"device_name" : "",
"real_device" : null
},
"status": "passed",
"duration" : 300, // in seconds
"scenario_name" : null
},
{
"test_id": "315d0cfdf7d77a42243ff87c0d6764cc8d3fj38j",
"name": "Sample Test 02 | Bstackdemo add to cart",
"url": "https://bstackdemo.com",
"test_execution_id": "315d0cfdf7d77a42243ff87c0d6764cc8d3fj38j",
"device_config": {
"type" : "desktop",
"browser" : "safari",
"browser_version" : "16.5",
"device_name" : "",
"real_device" : null
},
"status": "passed",
"duration" : 300,
"scenario_name" : null
}
]
}
}
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.