Skip to main content
No Result Found
Connect & Get help from fellow developers on our Discord community. Ask the CommunityAsk the Community

Finish test run API in Test Reporting & Analytics

Use this API to complete a test run with its final result, timing information, and optional failure details or step-level metadata.

Finish a test run

PUT https://api-automation.browserstack.com/ext/v1/builds/{{BUILD_HASHED_ID}}/tests/{{TEST_RUN_UUID}}/finish

Request parameters

Request

curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X PUT "https://api-automation.browserstack.com/ext/v1/builds/BUILD_HASHED_ID/tests/TEST_RUN_UUID/finish" \
-H "Content-Type: application/json" \
-d '{
  "result": "passed",
  "finished_at": "2025-11-11T10:30:10Z",
  "file_name": "tests/login_test.py",
  "scopes": ["Authentication", "Smoke"]
}'
  • result* String

    Final result of the test. Allowed values are passed, failed, skipped, or timeout.

  • finished_at* String (ISO 8601)

    Test completion timestamp in ISO 8601 format (for example, 2025-11-11T10:31:45Z).

  • file_name* String

    Name of the test file. Maximum 1000 characters.

  • scopes* Array

    Test scopes. Between 1 and 20 scopes, each up to 100 characters.

  • duration_in_ms Integer

    Total duration of the test in milliseconds. Must be a positive integer.

  • failure Array

    Failure details when the test result is failed. Maximum 100 failure entries.

    â–¶ SHOW VALUES
    • backtrace Array

      Stack trace of the failure as an array of strings. Maximum 1000 lines, each up to 2000 characters.

  • custom_metadata Object

    Custom key-value metadata. Maximum 25 keys, 10 values per key, 500 characters per key or value.

  • environment Object

    Environment details. When provided, these values override any values set in the start test run call.

    â–¶ SHOW VALUES
    • device String

      Device name used to run the test. Maximum 100 characters.

    • os String

      Operating system used to run the test. Maximum 100 characters.

    • os_version String

      Operating system version. Maximum 50 characters.

    • browser String

      Browser used to run the test. Maximum 100 characters.

    • browser_version String

      Browser version. Maximum 50 characters.

  • meta Object

    Test execution metadata including step-level details.

    â–¶ SHOW VALUES
    • steps Array

      An array of step objects representing individual steps within the test or hook execution.

      â–¶ SHOW VALUES
      • id* String

        Unique identifier for the step within the test run.

      • keyword String

        Step keyword, typically used in BDD frameworks (for example, Given, When, Then).

      • text String

        Step description or display text.

      • started_at String (ISO 8601)

        Step start timestamp in ISO 8601 format.

      • finished_at String (ISO 8601)

        Step completion timestamp in ISO 8601 format.

      • result String

        Step result. Allowed values are passed, failed, skipped, or timeout.

      • duration Integer

        Step duration in milliseconds.

      • failure String

        Failure message or error description for a failed step. Maximum 5000 characters.

  • hooks Array

    An array of hook UUIDs associated with this test run.

Response attributes 200 OK JSON

Response

{
  "success": true,
  "message": "Test run updated successfully."
}
  • success Boolean

    Indicates if the test was finished successfully.

  • message String

    A success or error message describing the result of the operation.

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

Download Copy Check Circle