Quick start guide to integrate BrowserStack Test Observability with Serenity BDD
Pre-requisites
You have a Serenity BDD test suite.
You may run your tests on BrowserStack Automate or even on any other cloud provider or even locally.
Your tests can be unit / integration / functional or of any nature.
Integrate with Test Observability
You can use BrowserStack Test Observability both when you’re using BrowserStack’s devices and browsers to run your functional end-to-end tests and also if you’re running tests locally on your laptop/CI system or even when you’re using some other cloud provider.
Not only that, Test Observability is agnostic to the type of testing and hence you could also integrate it with your unit or integration test suite written using Serenity.
Please select your setup below to get started with an awesome debugging experience with Test Observability:
To start using BrowserStack Test Observability with your existing setup of Serenity tests running on BrowserStack Automate, you’d need to integrate with browserstack-java-sdk (if not already done). Follow one of the methods below to integrate the SDK and start using Test Observability:
If you’re an existing browserstack-java-sdk user, you can skip the steps below. However, ensure that you’ve specified static names (names should not change across build runs) for projectName and buildName in the browserstack.yml file in your project. Also, restrict the characters in your projectName and buildName to alphanumeric characters (A-Z, a-z, 0-9), underscores (_), colons (:), and hyphens (-). Any other character will be replaced with a space.
On the Eclipse toolbar, click Help > Eclipse Marketplace. In the Eclipse Marketplace, search for BrowserStack > click Install > Finish.
Configure your test suite with BrowserStack SDK
BrowserStack plugin automatically adds the browserstack-java-sdk dependency to your pom.xml file and generates a browserstack.yml configuration file.
Right-click on your project folder > BrowserStack > select Integrate with Automate SDK.
Select your Project Folder, Framework, and other BrowserStack Parameters, and then click Integrate.
Update browserstack.yml file
Update the browserstack.yml file in the root folder of your test suite.
```yml
userName: YOUR_USERNAME
accessKey: YOUR_ACCESS_KEY
buildName: "Your static build/job name goes here"
projectName: "Your static project name goes here"
CUSTOM_TAG_1: "You can set a custom Build Tag here"
# Use CUSTOM_TAG_<N> and set more build tags as you need.
framework: serenity
testObservability: true
browserstackAutomation: false # Set to true for tests on BrowserStack products.
```
userName: YOUR_USERNAME
accessKey: YOUR_ACCESS_KEY
buildName:"Your static build/job name goes here"projectName:"Your static project name goes here"CUSTOM_TAG_1:"You can set a custom Build Tag here"# Use CUSTOM_TAG_<N> and set more build tags as you need.framework: serenity
testObservability:truebrowserstackAutomation:false# Set to true for tests on BrowserStack products.
The projectName and buildName config must be static and not change across different runs of the same build. This is a deviation in approach as specified by BrowserStack Automate or App Automate as Test Observability will automatically identify different build runs.
Restrict the characters in your projectName and buildName to alphanumeric characters (A-Z, a-z, 0-9), underscores (_), colons (:), and hyphens (-). Any other character will be replaced with a space.
BrowserStack SDK is a very powerful tool that you can use to set the different browser/device combinations and parallelization. For more details, check out the Automate Integration guide.
Run your test suite
Run your tests as usual.
View results and insights on Test Observability dashboards
Post build run completion, you’ll be able to see the build run report along with all necessary debugging information right on this dashboard.
Install BrowserStack plugin
Click IntelliJ IDEA > Preferences > Plugins. Search for BrowserStack and click Install.
Configure your test suite with BrowserStack SDK
BrowserStack plugin automatically adds the browserstack-java-sdk dependency to your pom.xml file and generates a browserstack.yml configuration file.
Right-click on your project folder > BrowserStack > select Integrate with Automate SDK.
Select your Project Folder, Framework, and other BrowserStack Parameters, and then click Integrate.
Update browserstack.yml file
Update the browserstack.yml file in the root folder of your test suite.
```yml
userName: YOUR_USERNAME
accessKey: YOUR_ACCESS_KEY
buildName: "Your static build/job name goes here"
projectName: "Your static project name goes here"
CUSTOM_TAG_1: "You can set a custom Build Tag here"
# Use CUSTOM_TAG_<N> and set more build tags as you need.
framework: serenity
testObservability: true
browserstackAutomation: false # Set to true for tests on BrowserStack products.
```
userName: YOUR_USERNAME
accessKey: YOUR_ACCESS_KEY
buildName:"Your static build/job name goes here"projectName:"Your static project name goes here"CUSTOM_TAG_1:"You can set a custom Build Tag here"# Use CUSTOM_TAG_<N> and set more build tags as you need.framework: serenity
testObservability:truebrowserstackAutomation:false# Set to true for tests on BrowserStack products.
The projectName and buildName config must be static and not change across different runs of the same build. This is a deviation in approach as specified by BrowserStack Automate or App Automate as Test Observability will automatically identify different build runs.
Restrict the characters in your projectName and buildName to alphanumeric characters (A-Z, a-z, 0-9), underscores (_), colons (:), and hyphens (-). Any other character will be replaced with a space.
BrowserStack SDK is a very powerful tool that you can use to set the different browser/device combinations and parallelization. For more details, check out the Automate Integration guide.
Run your test suite
Run your tests as usual.
View results and insights on Test Observability dashboards
Post build run completion, you’ll be able to see the build run report along with all necessary debugging information right on this dashboard.
```bash
# Set these values in your ~/.zprofile (zsh) or ~/.profile (bash)
export BROWSERSTACK_USERNAME="YOUR_USERNAME"
export BROWSERSTACK_ACCESS_KEY="YOUR_ACCESS_KEY"
```
# Set these values in your ~/.zprofile (zsh) or ~/.profile (bash)exportBROWSERSTACK_USERNAME="YOUR_USERNAME"exportBROWSERSTACK_ACCESS_KEY="YOUR_ACCESS_KEY"
```bash
setx BROWSERSTACK_USERNAME "YOUR_USERNAME"
setx BROWSERSTACK_ACCESS_KEY "YOUR_ACCESS_KEY"
set BROWSERSTACK_USERNAME=YOUR_USERNAME
set BROWSERSTACK_ACCESS_KEY=YOUR_ACCESS_KEY
```
Maven Archetype provides a template to quickly configure your project. Copy & run the adjacent command on your terminal/command prompt to add browserstack-java-sdk dependency in your pom.xml and browserstack.yml config file in your project.
Make changes in your browserstack.yml config file
Once you have installed the SDK, a browserstack.yml config file will be created at the root level of your project. This file holds all the required capabilities to run tests on BrowserStack.
BrowserStack SDK is a very powerful tool that you can use to set the different browser/device combinations and parallelization. For more details, check out the Automate Integration guide.
Make sure you copy the contents of the below config file and set it in your project’s browserstack.yml file:
```yml
userName: YOUR_USERNAME
accessKey: YOUR_ACCESS_KEY
buildName: "Your static build/job name goes here"
projectName: "Your static project name goes here"
CUSTOM_TAG_1: "You can set a custom Build Tag here"
# Use CUSTOM_TAG_<N> and set more build tags as you need.
framework: serenity
testObservability: true
browserstackAutomation: false # Set to true for tests on BrowserStack products.
```
userName: YOUR_USERNAME
accessKey: YOUR_ACCESS_KEY
buildName:"Your static build/job name goes here"projectName:"Your static project name goes here"CUSTOM_TAG_1:"You can set a custom Build Tag here"# Use CUSTOM_TAG_<N> and set more build tags as you need.framework: serenity
testObservability:truebrowserstackAutomation:false# Set to true for tests on BrowserStack products.
The projectName and buildName config must be static and not change across different runs of the same build. This is a deviation in approach as specified by BrowserStack Automate or App Automate as Test Observability will automatically identify different build runs.
Restrict the characters in your projectName and buildName to alphanumeric characters (A-Z, a-z, 0-9), underscores (_), colons (:), and hyphens (-). Any other character will be replaced with a space.
Run the adjacent command from the project’s root directory to run your test suite with BrowserStack.
Post build run completion, you’ll be able to see the build run report along with all necessary debugging information right on this dashboard.
Verify your pom.xml entries
As you’re an existing browserstack-java-sdk user, you must already have the following entry in your pom.xml file of your project. Please verify that the following exists:
The previous step outlines that your pom.xml must have the LATEST tag against the browserstack-java-sdk. Now, run the below command to ensure that the latest version is installed:
As you’re an existing browserstack-java-sdk user, you must already be having a browserstack.yml config file at the root level of your project.
Test Observability mandatorily needs the following four configurations in the file. You need not change anything but you have to ensure that the values of the buildName and projectName variables are not changing across different build runs.
```yml
userName: YOUR_USERNAME
accessKey: YOUR_ACCESS_KEY
buildName: "Your static build/job name of CI goes here"
projectName: "Your static project name goes here"
CUSTOM_TAG_1: "You can set a custom Build Tag here"
# Use CUSTOM_TAG_<N> and set more build tags as you need.
framework: serenity
testObservability: true
...
```
userName: YOUR_USERNAME
accessKey: YOUR_ACCESS_KEY
buildName:"Your static build/job name of CI goes here"projectName:"Your static project name goes here"CUSTOM_TAG_1:"You can set a custom Build Tag here"# Use CUSTOM_TAG_<N> and set more build tags as you need.framework: serenity
testObservability:true...
The projectName and buildName config must be static and not change across different runs of the same build. This is a deviation in approach as specified by BrowserStack Automate or App Automate as Test Observability will automatically identify different build runs.
Restrict the characters in your projectName and buildName to alphanumeric characters (A-Z, a-z, 0-9), underscores (_), colons (:), and hyphens (-). Any other character will be replaced with a space.
Run the adjacent command from the project’s root directory to run your test suite with BrowserStack.
Post build run completion, you’ll be able to see the build run report along with all necessary debugging information right on this dashboard.
To start using BrowserStack Test Observability with your existing setup of Serenity tests running on your local laptop or CI or even on any other cloud provider, you’d need to integrate the browserstack-java-sdk. Follow one of the methods below to integrate the SDK and start using Test Observability:
BrowserStack Test Observability works with any kind of automation tests. Use it with your unit or integration test suites and also your end-to-end functional test suite.
On the Eclipse toolbar, click Help > Eclipse Marketplace. In the Eclipse Marketplace, search for BrowserStack > click Install > Finish.
Configure your test suite with BrowserStack SDK
BrowserStack plugin automatically adds the browserstack-java-sdk dependency to your pom.xml file and generates a browserstack.yml configuration file.
Right-click on your project folder > BrowserStack > select Integrate with Automate SDK.
Select your Project Folder, Framework, and other BrowserStack Parameters, and then click Integrate.
Update browserstack.yml file
Update the browserstack.yml file in the root folder of your test suite.
```yml
userName: YOUR_USERNAME
accessKey: YOUR_ACCESS_KEY
buildName: "Your static build/job name goes here"
projectName: "Your static project name goes here"
CUSTOM_TAG_1: "You can set a custom Build Tag here"
# Use CUSTOM_TAG_<N> and set more build tags as you need.
framework: serenity
testObservability: true
browserstackAutomation: false # Set to true for tests on BrowserStack products.
```
userName: YOUR_USERNAME
accessKey: YOUR_ACCESS_KEY
buildName:"Your static build/job name goes here"projectName:"Your static project name goes here"CUSTOM_TAG_1:"You can set a custom Build Tag here"# Use CUSTOM_TAG_<N> and set more build tags as you need.framework: serenity
testObservability:truebrowserstackAutomation:false# Set to true for tests on BrowserStack products.
The projectName and buildName config must be static and not change across different runs of the same build. This is a deviation in approach as specified by BrowserStack Automate or App Automate as Test Observability will automatically identify different build runs.
Restrict the characters in your projectName and buildName to alphanumeric characters (A-Z, a-z, 0-9), underscores (_), colons (:), and hyphens (-). Any other character will be replaced with a space.
BrowserStack SDK is a very powerful tool that you can use to set the different browser/device combinations and parallelization. For more details, check out the Automate Integration guide.
Run your test suite
Run your tests as usual.
View results and insights on Test Observability dashboards
Post build run completion, you’ll be able to see the build run report along with all necessary debugging information right on this dashboard.
Install BrowserStack plugin
Click IntelliJ IDEA > Preferences > Plugins. Search for BrowserStack and click Install.
Configure your test suite with BrowserStack SDK
BrowserStack plugin automatically adds the browserstack-java-sdk dependency to your pom.xml file and generates a browserstack.yml configuration file.
Right-click on your project folder > BrowserStack > select Integrate with Automate SDK.
Select your Project Folder, Framework, and other BrowserStack Parameters, and then click Integrate.
Update browserstack.yml file
Update the browserstack.yml file in the root folder of your test suite.
```yml
userName: YOUR_USERNAME
accessKey: YOUR_ACCESS_KEY
buildName: "Your static build/job name goes here"
projectName: "Your static project name goes here"
CUSTOM_TAG_1: "You can set a custom Build Tag here"
# Use CUSTOM_TAG_<N> and set more build tags as you need.
framework: serenity
testObservability: true
browserstackAutomation: false # Set to true for tests on BrowserStack products.
```
userName: YOUR_USERNAME
accessKey: YOUR_ACCESS_KEY
buildName:"Your static build/job name goes here"projectName:"Your static project name goes here"CUSTOM_TAG_1:"You can set a custom Build Tag here"# Use CUSTOM_TAG_<N> and set more build tags as you need.framework: serenity
testObservability:truebrowserstackAutomation:false# Set to true for tests on BrowserStack products.
The projectName and buildName config must be static and not change across different runs of the same build. This is a deviation in approach as specified by BrowserStack Automate or App Automate as Test Observability will automatically identify different build runs.
Restrict the characters in your projectName and buildName to alphanumeric characters (A-Z, a-z, 0-9), underscores (_), colons (:), and hyphens (-). Any other character will be replaced with a space.
BrowserStack SDK is a very powerful tool that you can use to set the different browser/device combinations and parallelization. For more details, check out the Automate Integration guide.
Run your test suite
Run your tests as usual.
View results and insights on Test Observability dashboards
Post build run completion, you’ll be able to see the build run report along with all necessary debugging information right on this dashboard.
```bash
# Set these values in your ~/.zprofile (zsh) or ~/.profile (bash)
export BROWSERSTACK_USERNAME="YOUR_USERNAME"
export BROWSERSTACK_ACCESS_KEY="YOUR_ACCESS_KEY"
```
# Set these values in your ~/.zprofile (zsh) or ~/.profile (bash)exportBROWSERSTACK_USERNAME="YOUR_USERNAME"exportBROWSERSTACK_ACCESS_KEY="YOUR_ACCESS_KEY"
```bash
setx BROWSERSTACK_USERNAME "YOUR_USERNAME"
setx BROWSERSTACK_ACCESS_KEY "YOUR_ACCESS_KEY"
set BROWSERSTACK_USERNAME=YOUR_USERNAME
set BROWSERSTACK_ACCESS_KEY=YOUR_ACCESS_KEY
```
Maven Archetype provides a template to quickly configure your project. Copy & run the adjacent command on your terminal/command prompt to add browserstack-java-sdk dependency in your pom.xml and browserstack.yml config file in your project.
Make changes in your browserstack.yml config file
Once you have installed the SDK, a browserstack.yml config file will be created at the root level of your project. This file holds all the required capabilities to run tests on BrowserStack.
BrowserStack SDK is a very powerful tool that you can use to set the different browser/device combinations and parallelization. For more details, check out the Automate Integration guide.
Make sure you copy the contents of the below config file and set it in your project’s browserstack.yml file:
```yml
userName: YOUR_USERNAME
accessKey: YOUR_ACCESS_KEY
buildName: "Your static build/job name goes here"
projectName: "Your static project name goes here"
CUSTOM_TAG_1: "You can set a custom Build Tag here"
# Use CUSTOM_TAG_<N> and set more build tags as you need.
framework: serenity
testObservability: true
browserstackAutomation: false # Set to true for tests on BrowserStack products.
```
userName: YOUR_USERNAME
accessKey: YOUR_ACCESS_KEY
buildName:"Your static build/job name goes here"projectName:"Your static project name goes here"CUSTOM_TAG_1:"You can set a custom Build Tag here"# Use CUSTOM_TAG_<N> and set more build tags as you need.framework: serenity
testObservability:truebrowserstackAutomation:false# Set to true for tests on BrowserStack products.
The projectName and buildName config must be static and not change across different runs of the same build. This is a deviation in approach as specified by BrowserStack Automate or App Automate as Test Observability will automatically identify different build runs.
Restrict the characters in your projectName and buildName to alphanumeric characters (A-Z, a-z, 0-9), underscores (_), colons (:), and hyphens (-). Any other character will be replaced with a space.