Skip to content

This repository provides a Java-based integration between Vansah and BrowserStack, enabling seamless test result synchronization and automated execution reporting.

Notifications You must be signed in to change notification settings

testpointcorp/vansah-browserstack-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Vansah Logo

This repository provides a Java-based integration between Vansah and BrowserStack, enabling seamless Test Result synchronization and automated execution reporting.

It allows teams to connect BrowserStack Test Runs directly with Vansah Test Management, ensuring real-time visibility of automated test outcomes within Jira.

With this integration, you can:

  • Automatically update Vansah Test Results from BrowserStack executions
  • Link automated tests with Vansah Test Cases and Test Runs
  • Streamline CI/CD workflows for improved traceability and reporting


WebsiteMore Connect Integrations


Table of Contents


Features

  • ✅ Ready-to-run JUnit 5 and Selenium tests on BrowserStack
  • ✅ Integrates with Vansah Java Binding to create Test Runs and Log Steps (with screenshots)

Prerequisites


Install / Clone

git clone https://github.com/testpointcorp/vansah-browserstack-java.git
cd vansah-browserstack-java

Configure Credentials (Environment Variables)

Create a .env file in your project root (do not commit this file to version control).
Below is an example configuration for BrowserStack and Vansah:

# -------------------------------
# BrowserStack Configuration
# -------------------------------
export BROWSERSTACK_USERNAME=<your-username>
export BROWSERSTACK_ACCESS_KEY=<your-access-key>
export BROWSERSTACK_BUILD_NAME="Vansah Build"
export BROWSERSTACK_PROJECT_NAME="Vansah BrowserStack"
export BROWSERSTACK_SESSION_NAME="Vansah Trial Runs"

# -------------------------------
# Vansah Configuration
# -------------------------------
export VANSAH_BASE_URL= # https://help.vansah.com/en/articles/10407923-vansah-api-connect-url
export VANSAH_API_TOKEN= # https://help.vansah.com/en/articles/9824979-generate-a-vansah-api-token-from-jira
export VANSAH_ENVIRONMENT= # https://help.vansah.com/en/articles/9821822-test-environments
export VANSAH_TESTCASE_KEY= # https://help.vansah.com/en/articles/12814796-what-is-a-test-case#h_529238a0fc

# -------------------------------
# Choose ONE style for Vansah execution
# -------------------------------

# (A) Jira Issue style
export VANSAH_JIRA_ISSUE_KEY= # https://help.vansah.com/en/articles/9822263-linking-test-cases-to-a-jira-issue
export VANSAH_PROJECT_KEY= # https://help.vansah.com/en/articles/9821808-updating-your-jira-project-key

# (B) Folder style
export VANSAH_FOLDER_PATH= # https://help.vansah.com/en/articles/9824708-test-folder-path-in-test-case-export

# (C) Standard Test Plan (STP)
# export VANSAH_STP_KEY= # https://help.vansah.com/en/articles/9824605-creating-a-test-plan-from-a-test-folder

# (D) Advanced Test Plan (ATP)
# export VANSAH_ATP_KEY= # https://help.vansah.com/en/articles/9855761-understanding-advanced-test-plans
# export VANSAH_ATP_ASSET_TYPE="folder"  # or 'issue'

Alternatively, create a .env file using the sample file located at:

src/test/resources/.env.example

Execute Tests on BrowserStack

Run the Maven project to execute your test suite:

mvn test
  • The test opens selenium.vansah.io on a real Chrome instance in BrowserStack.
  • It validates the page title, captures Screenshots, Logs each step to Vansah, and updates the BrowserStack session status as passed/failed.
  • Screenshots are stored under target/screenshots/ and automatically uploaded to Vansah via the addTestLog(...) method.

Viewing Results & Traceability

  • BrowserStack: View live and saved sessions, videos, and execution logs for each build.
  • Vansah: Open your project, Test Plan, or Test Run to access:
    • Test case execution status
    • Linked BrowserStack session URL
    • Error messages and stack traces
    • Execution metadata (build, environment, browser/OS)

Project Layout

vansah-browserstack-java/
├─ src/
│  ├─ main/
│  │  └─ java/
│  │     └─ com/
│  │        └─ vansah/
│  │           └─ VansahNode.java
│  └─ test/
│     ├─ java/
│     │  └─ com/
│     │     └─ example/
│     │        └─ browserstack/
│     │           ├─ TestSetup.java
│     │           └─ VansahBrowserStackTest.java
│     └─ resources/
│        └─ .env.example
├─ target/                      
│  ├─ surefire-reports/         
│  └─ screenshots/              
├─ .gitignore                   
├─ pom.xml                      
├─ README.md                    

Notes:

  • Copy src/test/resources/.env.example to your project root as .env.
  • The target/ directory stores build artifacts, reports, and screenshots.

Implementation in Your Project

This demo project leverages VansahNode.java to send results to Jira.

Before integrating it into your own project, ensure this demo runs successfully.

  1. Download VansahNode.java from the repository.
  2. Copy it into your project’s Java source directory.
  3. Confirm the following dependencies exist in your pom.xml:
<dependency>
  <groupId>org.apache.commons</groupId>
  <artifactId>commons-lang3</artifactId>
  <version>3.12.0</version>
</dependency>
<dependency>
  <groupId>com.mashape.unirest</groupId>
  <artifactId>unirest-java</artifactId>
  <version>1.4.9</version>
</dependency>
<dependency>
  <groupId>io.github.cdimascio</groupId>
  <artifactId>dotenv-kotlin</artifactId>
  <version>6.5.1</version>
</dependency>

Reference

Refer to our help page
Get Vansah API Connect URL
Generate a Vansah Api Token
Generate and configure Vansah Test Environment
What is the Test Case in Vansah
Linking a Test Case to a Jira Issue
Get Vansah Project Key
Link Test Cases to Test Folder
Get Vansah Folder Path
More Info on Advanced Test Plan

Contributing

We welcome contributions!
Feel free to open issues or submit pull requests to improve this integration.


Developed By

Vansah

About

This repository provides a Java-based integration between Vansah and BrowserStack, enabling seamless test result synchronization and automated execution reporting.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 6

Languages