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.
Generate and import test results using TestNG
Generate and import test results using WebdriverIO
Generate and import test results using Nightwatch JS
Generate and import test results using Appium
Generate and import test results using Cypress
Generate and import test results using Mocha
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>"
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
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
- Log in to the Test Management.
- Select the relevant project that has the test report uploaded.
- Click Test Runs.
- Open the Test Run generated from automation test exectution.
- You will find all the test cases with their respective results here.
CI/CD References
- Create and import test reports using Jenkins
- 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
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!