Sessions
Each executed build is composed of one or more test sessions. By default, each session is the execution of your test-suite on a single device. Thus, each device in the build will have a single test session. However, if sharding is used, each session is the execution of a single shard on a single device. Thus, each device in the build will have multiple sessions (one for each shard).
Each session has a unique identifier (session ID
) associated with it. This can be obtained using our Get build status
endpoint. Using this session ID, you can use our REST API to access its test execution details including test results and debugging information for each individual test case.
Get session details
Fetch status and test execution details for a given test session. You can access test results as well as debugging information such as instrumentation logs, device logs, network logs etc for individual test cases.
Request parameters
Request
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X GET "https://api-cloud.browserstack.com/app-automate/espresso/v2/builds/57dd68e05f76ca3c9c0d4600fd78ae064fa537bb/sessions/c9215a31aace1d2b885f1c7a9f5d73bce55b4543"
-
buildID* String
Build ID of the test session.
-
sessionID* String
Session ID.
Response attributes 200
application/json
Response
{
"id": "c9215a31aace1d2b885f1c7a9f5d73bce55b4543",
"status": "failed",
"start_time": "2020-06-04 07:44:20 +0000",
"duration": 43,
"testcases": {
"count": 6,
"status": {
"passed": 0,
"failed": 6,
"skipped": 0,
"timedout": 0,
"error": 0,
"running": 0,
"queued": 0
},
"data": [
{
"class": "EnsureOperationTests",
"testcases": [
{
"name": "ensureMultiplicationWorks",
"start_time": "2020-06-04 07:44:25 +0000",
"status": "failed",
"duration": "2.057",
"video": "https://api.browserstack.com/app-automate/espresso/builds/57cc68e05f76ca3c9c0d4600fd78ae064fa537bb/sessions/tests/c9215a31aace1d2b885f1c7a9f5d73bce55b4543406d4de4/video#t=0,5",
"id": "c9215a31aace1d2b885f1c7a9f5d73bce55b4543406d4de4",
"instrumentation_log": "https://api.browserstack.com/app-automate/espresso/builds/57cc68e05f76ca3c9c0d4600fd78ae064fa537bb/sessions/tests/c9215a31aace1d2b885f1c7a9f5d73bce55b4543406d4de4/instrumentationlogs",
"device_log": "https://api.browserstack.com/app-automate/espresso/builds/57cc68e05f76ca3c9c0d4600fd78ae064fa537bb/sessions/tests/c9215a31aace1d2b885f1c7a9f5d73bce55b4543406d4de4/devicelogs",
"network_log": "https://api.browserstack.com/app-automate/espresso/builds/57cc68e05f76ca3c9c0d4600fd78ae064fa537bb/sessions/tests/c9215a31aace1d2b885f1c7a9f5d73bce55b4543406d4de4/networklogs"
},
{
"name": "ensureDivisionWorks",
"start_time": "2020-06-04 07:44:31 +0000",
"status": "failed",
"duration": "1.96",
"video": "https://api.browserstack.com/app-automate/espresso/builds/57cc68e05f76ca3c9c0d4600fd78ae064fa537bb/sessions/tests/c9215a31aace1d2b885f1c7a9f5d73bce55b4543e5295377/video#t=6,11",
"id": "c9215a31aace1d2b885f1c7a9f5d73bce55b4543e5295377",
"instrumentation_log": "https://api.browserstack.com/app-automate/espresso/builds/57cc68e05f76ca3c9c0d4600fd78ae064fa537bb/sessions/tests/c9215a31aace1d2b885f1c7a9f5d73bce55b4543e5295377/instrumentationlogs",
"device_log": "https://api.browserstack.com/app-automate/espresso/builds/57cc68e05f76ca3c9c0d4600fd78ae064fa537bb/sessions/tests/c9215a31aace1d2b885f1c7a9f5d73bce55b4543e5295377/devicelogs",
"network_log": "https://api.browserstack.com/app-automate/espresso/builds/57cc68e05f76ca3c9c0d4600fd78ae064fa537bb/sessions/tests/c9215a31aace1d2b885f1c7a9f5d73bce55b4543e5295377/networklogs"
}
]
},
{
"class": "EnsureInputTests",
"testcases": [
{
"name": "ensureMultipleInputIsHandled",
"start_time": "2020-06-04 07:44:50 +0000",
"status": "failed",
"duration": "0.313",
"video": "https://api.browserstack.com/app-automate/espresso/builds/57cc68e05f76ca3c9c0d4600fd78ae064fa537bb/sessions/tests/c9219a12aace1d2b885f1c7a9f5d73bce55b454324e815c7/video#t=25,28",
"id": "c9219a12aace1d2b885f1c7a9f5d73bce55b454324e815c7",
"instrumentation_log": "https://api.browserstack.com/app-automate/espresso/builds/57cc68e05f76ca3c9c0d4600fd78ae064fa537bb/sessions/tests/c9219a12aace1d2b885f1c7a9f5d73bce55b454324e815c7/instrumentationlogs",
"device_log": "https://api.browserstack.com/app-automate/espresso/builds/57cc68e05f76ca3c9c0d4600fd78ae064fa537bb/sessions/tests/c9219a12aace1d2b885f1c7a9f5d73bce55b454324e815c7/devicelogs",
"network_log": "https://api.browserstack.com/app-automate/espresso/builds/57cc68e05f76ca3c9c0d4600fd78ae064fa537bb/sessions/tests/c9219a12aace1d2b885f1c7a9f5d73bce55b454324e815c7/networklogs"
}
]
}
]
},
}
-
id String
Sesssion ID.
Example:5c5ab4338cec13aeb78f7a6977344556ac00bccd6
-
status String
Test session status. Know more about viewing test status
-
start_time String
Timestamp for starting test session execution.
-
duration String
Total duration for test session execution.
-
testcases Object
Details about each test-case execution for this session.
-
count Integer
The total number of test cases in the session
-
status Object
Count of the test cases for each status types.
-
passed Integer
Total count of test cases with explicit test assertions that marks the test as passed.
-
failed Integer
Total count of test cases with uncaught exceptions or explicit test assertions that marks test as failed.
-
skipped Integer
Total count of test cases that never got executed by the test runner.
-
timedout Integer
Total count of test cases that got timed-out.
-
error Integer
Total count of test cases that errored due to an unanticipated issue on BrowserStack.
-
running Integer
Total count of test cases that are currently under execution.
-
queued Integer
Total count of test cases that are queued for execution.
-
-
data Array
Details about the test case execution.
-
class String
Name of the class containing the test cases.
-
testcases Array
List of all the test cases belonging to given class and their test execution details.
-
name String
Name of the test case
-
start_time String
Timestamp at which the test execution started.
-
status String
Status of the test case execution on a given device or session. Different values for test case status:
Key Value passed
Explicit assertion in the test case that marks the test as passed. failed
Explicit assertion in the test case that marks the test as failed. This can also happen if there is an uncaught runtime exception during test execution. skipped
A test case that was never invoked during the test-suite execution. It can happen in two different scenarios :
(a) The session got timed out (by BrowserStack) because it exceeded 2 hour limit. All remaining test cases in the session will be marked as skipped.
(b) Execution of a test case is skipped by the test runner. For e.g. This can happen if the test case uses an @Ignore annotation.timedout
Execution of a test case (in a running state) is halted either because :
(a) The session got timed out (by BrowserStack) because it exceeded 2 hour limit
(b) The test case wasidle
for 15 mins (Idle
is defined as no update from the test runner)error
An errored test is one that failed due to an unanticipated issue on BrowserStack testing infrastructure. running
Test case that is being executed by the test runner. queued
Test case queued for execution. This is the default initial state. -
duration String
Total duration of test case execution on the given device.
-
video String
URL to fetch video logs for the test case execution.
-
id String
Unique ID of the test case execution on the given device.
-
instrumentation_log String
URL to fetch instrumentation logs for the test case execution.
-
device_log String
URL to fetch device logs for the test case execution if you’ve set the
deviceLogs
parameter totrue
when running the test case. -
network_log String
URL to fetch network logs for the test case execution if you’ve set the
networkLogs
parameter totrue
when running the test case.
-
-
-
Get JUNIT XML report
Fetch JUnit XML report for a given test session.
Request parameters
Request
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X GET "https://api-cloud.browserstack.com/app-automate/espresso/v2/builds/57dd68e05f76ca3c9c0d4600fd78ae064fa537bb/sessions/c9215a31aace1d2b885f1c7a9f5d73bce55b4543/report"
-
buildID* String
Build ID of the build to which the session belongs.
-
sessionID* String
Session ID.
Response 200
text/xml
Response
<?xml version="1.0"?>
<testsuites>
<testsuite name="com.sample.browserstack.samplecalculator.EnsureInputTests" tests="2" failures="2" skipped="0" timedout="0" errors="0" time="4.419" timestamp="2020-06-04 07:44:14 +0000">
<properties>
<property session_id="c9215a31aace1d2b885f1c7a9f5d73bce55b4543"/>
<property devicename="Google Pixel 3"/>
<property os="Android"/>
<property version="9"/>
</properties>
<testcase name="ensureMultipleInputIsHandled" classname="com.sample.browserstack.samplecalculator.EnsureInputTests" result="failed" test_id="be2460f7f5fd21f73673060d4046199e6a94d9e624e815c7" time="0.422" video_url="https://www.browserstack.com/s3-upload/bs-video-logs-aps/s3-ap-south-1/be2460f7f5fd21f73673060d4046199e6a94d9e6/video-be2460f7f5fd21f73673060d4046199e6a94d9e6.mp4#t=0,3">
<failure>java.lang.RuntimeException: Unable to capture screenshot.
... 32 more
</failure>
</testcase>
</testsuite>
<testsuite name="com.sample.browserstack.samplecalculator.EnsureOperationTests" tests="4" failures="4" skipped="0" timedout="0" errors="0" time="22.643" timestamp="2020-06-04 07:44:22 +0000">
<properties>
<property session_id="c9215a31aace1d2b885f1c7a9f5d73bce55b4543"/>
<property devicename="Google Pixel 3"/>
<property os="Android"/>
<property version="9"/>
</properties>
<testcase name="ensureMultiplicationWorks" classname="com.sample.browserstack.samplecalculator.EnsureOperationTests" result="failed" test_id="be2460f7f5fd21f73673060d4046199e6a94d9e6406d4de4" time="2.366" video_url="https://www.browserstack.com/s3-upload/bs-video-logs-aps/s3-ap-south-1/be2460f7f5fd21f73673060d4046199e6a94d9e6/video-be2460f7f5fd21f73673060d4046199e6a94d9e6.mp4#t=8,13">
<failure>java.lang.RuntimeException: Unable to capture screenshot.
... 32 more
</failure>
</testcase>
<testsuite name="com.sample.browserstack.samplecalculator.ExampleInstrumentedTest" tests="1" failures="0" skipped="0" timedout="0" errors="0" time="0.009" timestamp="2020-06-04 07:45:01 +0000">
<properties>
<property session_id="c9215a31aace1d2b885f1c7a9f5d73bce55b4543"/>
<property devicename="Google Pixel 3"/>
<property os="Android"/>
<property version="9"/>
</properties>
<testcase name="useAppContext" classname="com.sample.browserstack.samplecalculator.ExampleInstrumentedTest" result="passed" test_id="be2460f7f5fd21f73673060d4046199e6a94d9e65e747bcf" time="0.009" video_url="https://www.browserstack.com/s3-upload/bs-video-logs-aps/s3-ap-south-1/be2460f7f5fd21f73673060d4046199e6a94d9e6/video-be2460f7f5fd21f73673060d4046199e6a94d9e6.mp4#t=47,50"/>
</testsuite>
</testsuites>
The response will be XML report comprising the details of each test-case execution in the session.
Get code coverage report
Retrieve the Jacoco code coverage report for a given test session. In order to use the code coverage report, you need to ensure following:
- Your Android project uses Jacoco code coverage library
- Ensure
testCoverageEnabled
parameter set to true in your project’s build gradle file. - The
coverage
parameter should be set to true while using theExecute a build
.
here
.
Request parameters
Request
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X GET "https://api-cloud.browserstack.com/app-automate/espresso/v2/builds/57dd68e05f76ca3c9c0d4600fd78ae064fa537bb/sessions/c9215a31aace1d2b885f1c7a9f5d73bce55b4543/coverage"
-
buildID* String
Build ID of the build to which the session belongs.
-
sessionID* String
Session ID.
Response 200
application/octet-stream
The response will be a binary code coverage report comprising the details of each test-case execution.
Get app profiling data
Access the app profiling logs to view the resource consumption(CPU, memory, battery, and network) by your app on the device. The logs are only available for Android.
Request Parameters
Request
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X GET "https://api-cloud.browserstack.com/app-automate/espresso/v2/builds/{buildID}/sessions/tests/{testID}/appprofiling"
-
buildID* String
The build ID of the build to which the session belongs to.
-
TestID* String
The testID of a test case execution. Each test case has a unique identifier (testID) associated with it. You can obtain this using our Get session details endpoint.
Response Attributes 200 OK
application/json
Response
[
{
"ts": 1600264609,
"cpu": 35,
"mem": 5633,
"mema": 3063,
"batt": 100,
"temp": 22
},
{...}
]
-
ts Integer
Epoch time.
-
cpu Integer
Percentage of CPU utilisation of overall device.
-
mem Integer
RAM utilisation of overall device in MB.
-
mema Integer
RAM available in device in MB.
-
batt Integer
Battery percentage.
-
temp Integer
Temperature of device in Celsius.
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.