Use Vansah’s Java example to run Selenium tests on BrowserStack and send their results to Vansah. The example creates Test Runs, records step results, and uploads captured screenshots through the included Vansah Java binding.
Before you begin
Install Java 11 or later, Maven 3.8 or later, and Git.
Have a BrowserStack account with a username and access key for remote browser sessions.
Install Vansah in Jira and obtain your Vansah API base URL and a Vansah API token configured for Jira access. The token account needs permission to execute tests in the target Jira space.
Prepare an existing Multi Steps Test Case with steps 1 and 2. The supplied tests record results against those step numbers.
Link the Test Case to an existing Jira work item and a Test Folder in your test space. The example suite contains a separate test for each of these contexts.
1. Download the example
git clone https://github.com/testpointcorp/vansah-browserstack-java.git
cd vansah-browserstack-java
Open the official example repository and review TestSetup.java and VansahBrowserStackTest.java before running it. The demo visits https://selenium.vansah.io/.
2. Configure your local settings
Create a file named .env in the repository’s root directory, beside pom.xml. Replace every placeholder and synthetic example below with your own settings. Use plain NAME=value entries; the example loads them with Dotenv.
BROWSERSTACK_USERNAME="YOUR_BROWSERSTACK_USERNAME"
BROWSERSTACK_ACCESS_KEY="YOUR_BROWSERSTACK_ACCESS_KEY"
BROWSERSTACK_BUILD_NAME="Checkout regression"
BROWSERSTACK_PROJECT_NAME="Vansah demo"
BROWSERSTACK_SESSION_NAME="Sign-in checks"
VANSAH_URL="https://YOUR_VANSAH_HOST"
VANSAH_TOKEN="YOUR_VANSAH_API_TOKEN"
VANSAH_PROJECT_KEY="DEMO"
VANSAH_TESTCASE_KEY="DEMO-C46"
VANSAH_JIRA_ISSUE_KEY="DEMO-123"
VANSAH_FOLDER_PATH="Regression/Checkout/"
VANSAH_ENVIRONMENT="QA"
Setting | What to enter |
| Your BrowserStack credentials. Keep them private. |
| Readable names for finding the execution in BrowserStack. |
| Your workspace’s Vansah base URL, without an API path or trailing slash. |
| Your Vansah API token. |
| The Jira space key, such as |
| The existing Test Case key, such as |
| The Jira work item linked to that case. |
| The linked Test Folder’s exact path. Copy the folder path from Vansah. |
| The testing environment name used for the run. |
Use VANSAH_URL and VANSAH_TOKEN for this example. Those are the names read by TestSetup.java, even if another README section uses different names. Keep .env out of version control.
3. Run the example
mvn test
The suite opens remote Chrome sessions on Windows 11, visits the demo site, records step results, and sets each BrowserStack session’s status. Captured screenshot files are saved under target/screenshots/ and passed to Vansah as step evidence.
Running this command creates remote browser sessions and writes Test Runs and logs to Vansah. Use your intended test account and Jira space.
4. Verify both results
In BrowserStack, find the build and inspect both sessions, their status, and any errors.
In Vansah, open the supplied Test Case or its linked work item and folder. Find the new Test Runs.
Check that steps 1 and 2 have the intended results and comments, and that the captured screenshot is attached to the relevant log.
Review the Maven console for Vansah API errors and warnings.
A successful Maven build alone does not verify the integration. The demo catches some assertion and logging failures instead of rethrowing them. Confirm the saved BrowserStack status and Vansah logs before treating the setup as successful.
Troubleshooting and next steps
Problem | What to check |
Missing credentials or wrong Vansah host | Check the root .env file and exact setting names. Use your own Vansah base URL and current token. |
Run or step cannot be found | Check the Test Case links, Jira space key, exact folder path, script format, and existing step numbers. |
Maven succeeds but results are missing | Read the console warnings and confirm API responses. The demo can catch failures without failing the build. |
BrowserStack and Vansah show different results | Review each session and Test Run separately; the example updates the two systems through separate calls. |
After validating the example, adapt its setup and result logging to your own tests. For Java binding methods and supported execution contexts, see Send Test Results to Vansah from Java.
