Skip to main content

JUnit-XML or BDD-JSON based report upload

You can create and upload test reports to BrowserStack Test Management using multiple frameworks through CLI. This enables you to sync test case reports on BrowserStack Test Management from your terminal.

Steps to upload the JUnit-XML or BDD-JSON test report

Junit-XMl or BDD-JSON test reports for other frameworks can be uploaded to Test Management with the following steps.

In a terminal, open the project directory and load the variables.

export TEST_MANAGEMENT_API_TOKEN="*************28a42"
export TEST_MANAGEMENT_PROJECT_NAME="<Project Name>"
export JUNIT_XML_FILE_PATH="<Report Path>"
export TEST_RUN_NAME="<Test Run Name"
export USER_EMAIL="<Email Address>"
export TEST_MANAGEMENT_API_TOKEN="*************28a42"
export TEST_MANAGEMENT_PROJECT_NAME="<Project Name>"
export BDD_JSON_FILE_PATH="<Report Path>"
export TEST_RUN_NAME="<Test Run Name"
export USER_EMAIL="<Email Address>"
Note: You can get your TEST_MANAGEMENT_API_TOKEN from the Active API Key section in the Settings of BrowserStack Test Management.

Upload the test report using the curl command.

curl -k -X POST https://test-management.browserstack.com/api/v1/import/results/xml/junit \
-u $TEST_MANAGEMENT_API_TOKEN \
-F project_name=$TEST_MANAGEMENT_PROJECT_NAME \
-F "file_path=@$JUNIT_XML_FILE_PATH" \
-F test_run_name="$TEST_RUN_NAME" \
-F user_email=$USER_EMAIL
curl -k -X POST https://test-management.browserstack.com/api/v1/import/results/json/bdd \
-u $TEST_MANAGEMENT_API_TOKEN \
-F project_name=$TEST_MANAGEMENT_PROJECT_NAME \
-F "file_path=@$BDD_JSON_FILE_PATH" \
-F test_run_name="$TEST_RUN_NAME" \
-F user_email=$USER_EMAIL
Note: Report upload takes 0-60 seconds depending on the size of your test suite. Do not interrupt the curl command until you get the response.

Access the test run report from the console generated URL

After your report is successfully uploaded, you see a message similar to the following in your terminal. This message also generates a URL with "url" parameter that you can use to access your automated test run.

{"message":"File uploaded successfully.","url":"https://test-management.browserstack.com/projects/<project id>/test-runs/<test run id>","success":true}

View test run report in Test Management

  1. Log in to the Test Management.
  2. Select the relevant project that has the test report uploaded.
  3. Click Test Runs.
  4. Open the Test Run generated from automation test exectution.
  5. You will find all the test cases with their respective results here.

CI/CD References

  1. Create and import test reports using Jenkins
  2. Create and import test reports using Azure DevOps

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

Is this page helping you?

Yes
No

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!

Talk to an Expert
Download Copy