Skip to main content
Table of Contents
Documentation home icon APP AUTOMATE API

Sessions API

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

GET /app-automate/xcuitest/v2/builds/{buildID}/sessions/{sessionID}

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/xcuitest/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/xcuitest/builds/57cc68e05f76ca3c9c0d4600fd78ae064fa537bb/sessions/tests/c9215a31aace1d2b885f1c7a9f5d73bce55b4543406d4de4/video#t=0,5",
                        "id": "c9215a31aace1d2b885f1c7a9f5d73bce55b4543406d4de4",
                        "instrumentation_log": "https://api.browserstack.com/app-automate/xcuitest/builds/57cc68e05f76ca3c9c0d4600fd78ae064fa537bb/sessions/tests/c9215a31aace1d2b885f1c7a9f5d73bce55b4543406d4de4/instrumentationlogs",
                        "device_log": "https://api.browserstack.com/app-automate/xcuitest/builds/57cc68e05f76ca3c9c0d4600fd78ae064fa537bb/sessions/tests/c9215a31aace1d2b885f1c7a9f5d73bce55b4543406d4de4/devicelogs",
                        "network_log": "https://api.browserstack.com/app-automate/xcuitest/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/xcuitest/builds/57cc68e05f76ca3c9c0d4600fd78ae064fa537bb/sessions/tests/c9215a31aace1d2b885f1c7a9f5d73bce55b4543e5295377/video#t=6,11",
                        "id": "c9215a31aace1d2b885f1c7a9f5d73bce55b4543e5295377",
                        "instrumentation_log": "https://api.browserstack.com/app-automate/xcuitest/builds/57cc68e05f76ca3c9c0d4600fd78ae064fa537bb/sessions/tests/c9215a31aace1d2b885f1c7a9f5d73bce55b4543e5295377/instrumentationlogs",
                        "device_log": "https://api.browserstack.com/app-automate/xcuitest/builds/57cc68e05f76ca3c9c0d4600fd78ae064fa537bb/sessions/tests/c9215a31aace1d2b885f1c7a9f5d73bce55b4543e5295377/devicelogs",
                        "network_log": "https://api.browserstack.com/app-automate/xcuitest/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/xcuitest/builds/57cc68e05f76ca3c9c0d4600fd78ae064fa537bb/sessions/tests/c9219a12aace1d2b885f1c7a9f5d73bce55b454324e815c7/video#t=25,28",
                        "id": "c9219a12aace1d2b885f1c7a9f5d73bce55b454324e815c7",
                        "instrumentation_log": "https://api.browserstack.com/app-automate/xcuitest/builds/57cc68e05f76ca3c9c0d4600fd78ae064fa537bb/sessions/tests/c9219a12aace1d2b885f1c7a9f5d73bce55b454324e815c7/instrumentationlogs",
                        "device_log": "https://api.browserstack.com/app-automate/xcuitest/builds/57cc68e05f76ca3c9c0d4600fd78ae064fa537bb/sessions/tests/c9219a12aace1d2b885f1c7a9f5d73bce55b454324e815c7/devicelogs",
                        "network_log": "https://api.browserstack.com/app-automate/xcuitest/builds/57cc68e05f76ca3c9c0d4600fd78ae064fa537bb/sessions/tests/c9219a12aace1d2b885f1c7a9f5d73bce55b454324e815c7/networklogs"
                    }
                ]
            }
        ]
    },
}
  • id String

    Sesssion ID.
    Example: 5c5ab4338cec13aeb78f7a6977344556ac00bccd6

  • status String

  • 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.

    SHOW VALUES
    • count Integer

      The total number of test cases in the session

    • status Object

      Count of the test cases for each status types.

      SHOW VALUES
      • 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.

      SHOW VALUES
      • 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.

        SHOW VALUES
        • 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 was idle 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 to true 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 to true when running the test case.

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.

We're continuously improving our docs. We'd love to know what you liked






Thank you for your valuable feedback