Skip to main content
No Result Found

Test Observability on TestNG

Quick start guide to integrate BrowserStack Test Observability with TestNG

Prerequisites

  • You have an account with BrowserStack (even a free trial works) and can get the Username and Access Key from your account profile.
  • You have a TestNG test suite which may be unit tests or functional tests (it’s okay even if you do not run your tests on BrowserStack infrastructure).

Integrate your TestNG test suite 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 TestNG.

Choose TestNG or TestNG Cucumber depending on your test setup.

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 TestNG tests running on BrowserStack Automate or App Automate, you’d need to integrate with the browserstack-java-sdk (if not already done). Use one of the following methods 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.

Install BrowserStack plugin

On the Eclipse toolbar, click Help > Eclipse Marketplace. In the Eclipse Marketplace, search for BrowserStack > click Install > Finish.

Search for BrowserStack plugin

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.

Eclipse Configuration

Select your Project Folder, Framework, and other BrowserStack Parameters, and then click Integrate.

Eclipse Configuration

Update browserstack.yml file

Update the browserstack.yml file in the root folder of your test suite.

browserstack.yml
Copy icon Copy

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.

Visit Test Observability

Install BrowserStack plugin

Click IntelliJ IDEA > Preferences > Plugins. Search for BrowserStack and click Install.

Intellij IDEA Configuration

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.

Intellij IDEA Configuration

Select your Project Folder, Framework, and other BrowserStack Parameters, and then click Integrate.

Intellij IDEA Configuration

Update browserstack.yml file

Update the browserstack.yml file in the root folder of your test suite.

browserstack.yml
Copy icon Copy

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.

Visit Test Observability

Set BrowserStack credentials

Saving your BrowserStack credentials as environment variables makes it easier to run your test suite from your local or CI environment.

Copy icon Copy
Copy icon Copy

Install BrowserStack SDK using Maven Archetype

Maven Archetype provides a template to quickly configure your project. Copy & run the following command on your terminal/command prompt to add browserstack-java-sdk dependency in your pom.xml and browserstack.yml config file in your project.

Copy icon Copy
Copy icon Copy


Please ensure that you now have at least browserstack-java-sdk v1.13.10 before proceeding.

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 following config file and set it in your project’s browserstack.yml file:

browserstack.yml
Copy icon Copy

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 your test suite with Test Observability

Run the following command from the project’s root directory to run your test suite with BrowserStack.

Copy icon Copy

Post build run completion, you will see the build URL of Test Observability. Alternatively, you can also navigate to your build run using Build Runs.

Visit Test Observability

Verify your pom.xml entries

Since 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:

pom.xml
Copy icon Copy

Install the latest SDK version

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:

Terminal
Copy icon Copy


Please ensure that you now have at least browserstack-java-sdk v1.13.10 before proceeding.

Verify your browserStack.yml config file

Since 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.

browserstack.yml
Copy icon Copy

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 your test suite with Test Observability

Run the following command from the project’s root directory to run your test suite with BrowserStack.

Copy icon Copy

Post build run completion, you will see the build URL of Test Observability. Alternatively, you can also navigate to your build run using Build Runs.

Visit Test Observability

To start using BrowserStack Test Observability with your existing setup of TestNG tests running on your local laptop or CI or even on any other cloud provider, you’d need to integrate the browserstack-java-sdk. Use one of the following methods 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.

Install BrowserStack plugin

On the Eclipse toolbar, click Help > Eclipse Marketplace. In the Eclipse Marketplace, search for BrowserStack > click Install > Finish.

Search for BrowserStack plugin

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.

Eclipse Configuration

Select your Project Folder, Framework, and other BrowserStack Parameters, and then click Integrate.

Eclipse Configuration

Update browserstack.yml file

Update the browserstack.yml file in the root folder of your test suite.

browserstack.yml
Copy icon Copy

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.

Visit Test Observability

Install BrowserStack plugin

Click IntelliJ IDEA > Preferences > Plugins. Search for BrowserStack and click Install.

Intellij IDEA Configuration

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.

Intellij IDEA Configuration

Select your Project Folder, Framework, and other BrowserStack Parameters, and then click Integrate.

Intellij IDEA Configuration

Update browserstack.yml file

Update the browserstack.yml file in the root folder of your test suite.

browserstack.yml
Copy icon Copy

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.

Visit Test Observability

Set BrowserStack credentials

Saving your BrowserStack credentials as environment variables makes it easier to run your test suite from your local or CI environment.

Copy icon Copy
Copy icon Copy

Install BrowserStack SDK using Maven Archetype

Maven Archetype provides a template to quickly configure your project. Copy & run the following command on your terminal/command prompt to add browserstack-java-sdk dependency in your pom.xml and browserstack.yml config file in your project along with the required variables.

Copy icon Copy
Copy icon Copy


Please ensure that you now have at least browserstack-java-sdk v1.13.10 before proceeding.

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.

Make sure you copy the contents of the below config file and set it in your project’s browserstack.yml file:

browserstack.yml
Copy icon Copy

The projectName and buildName config must be static and not change across different runs of the same build. Different runs of the same build/job would be automatically identified by Test Observability.

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 your test suite with Test Observability

Run the following command from the project’s root directory to run your test suite with BrowserStack.

Copy icon Copy

Post build run completion, you will see the build URL of Test Observability. Alternatively, you can also navigate to your build run using Build Runs.

Visit Test Observability

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 TestNG - Cucumber tests running on BrowserStack Automate or App Automate, you’d need to integrate with the browserstack-java-sdk (if not already done). Use one of the following methods 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.

Install BrowserStack plugin

On the Eclipse toolbar, click Help > Eclipse Marketplace. In the Eclipse Marketplace, search for BrowserStack > click Install > Finish.

Search for BrowserStack plugin

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.

Eclipse Configuration

Select your Project Folder, Framework, and other BrowserStack Parameters, and then click Integrate.

Eclipse Configuration

Update browserstack.yml file

Update the browserstack.yml file in the root folder of your test suite.

browserstack.yml
Copy icon Copy

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.

Visit Test Observability

Install BrowserStack plugin

Click IntelliJ IDEA > Preferences > Plugins. Search for BrowserStack and click Install.

Intellij IDEA Configuration

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.

Intellij IDEA Configuration

Select your Project Folder, Framework, and other BrowserStack Parameters, and then click Integrate.

Intellij IDEA Configuration

Update browserstack.yml file

Update the browserstack.yml file in the root folder of your test suite.

browserstack.yml
Copy icon Copy

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.

Visit Test Observability

Set BrowserStack credentials

Saving your BrowserStack credentials as environment variables makes it easier to run your test suite from your local or CI environment.

Copy icon Copy
Copy icon Copy

Install BrowserStack SDK using Maven Archetype

Maven Archetype provides a template to quickly configure your project. Copy & run the following command on your terminal/command prompt to add browserstack-java-sdk dependency in your pom.xml and browserstack.yml config file in your project.

Copy icon Copy
Copy icon Copy


Please ensure that you now have at least browserstack-java-sdk v1.13.10 before proceeding.

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 following config file and set it in your project’s browserstack.yml file:

browserstack.yml
Copy icon Copy

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 your test suite with Test Observability

Run the following command from the project’s root directory to run your test suite with BrowserStack.

Copy icon Copy

Post build run completion, you will see the build URL of Test Observability. Alternatively, you can also navigate to your build run using Build Runs.

Visit Test Observability

Verify your pom.xml entries

Since 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:

pom.xml
Copy icon Copy

Install the latest SDK version

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:

Terminal
Copy icon Copy


Please ensure that you now have at least browserstack-java-sdk v1.13.10 before proceeding.

Verify your browserStack.yml config file

Since 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.

browserstack.yml
Copy icon Copy

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 your test suite with Test Observability

Run the following command from the project’s root directory to run your test suite with BrowserStack.

Copy icon Copy

Post build run completion, you will see the build URL of Test Observability. Alternatively, you can also navigate to your build run using Build Runs.

Visit Test Observability

To start using BrowserStack Test Observability with your existing setup of TestNG - Cucumber tests running on your local laptop or CI or even on any other cloud provider, you’d need to integrate the browserstack-java-sdk. Use one of the following methods 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.

Install BrowserStack plugin

On the Eclipse toolbar, click Help > Eclipse Marketplace. In the Eclipse Marketplace, search for BrowserStack > click Install > Finish.

Search for BrowserStack plugin

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.

Eclipse Configuration

Select your Project Folder, Framework, and other BrowserStack Parameters, and then click Integrate.

Eclipse Configuration

Update browserstack.yml file

Update the browserstack.yml file in the root folder of your test suite.

browserstack.yml
Copy icon Copy

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.

Visit Test Observability

Install BrowserStack plugin

Click IntelliJ IDEA > Preferences > Plugins. Search for BrowserStack and click Install.

Intellij IDEA Configuration

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.

Intellij IDEA Configuration

Select your Project Folder, Framework, and other BrowserStack Parameters, and then click Integrate.

Intellij IDEA Configuration

Update browserstack.yml file

Update the browserstack.yml file in the root folder of your test suite.

browserstack.yml
Copy icon Copy

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.

Visit Test Observability

Set BrowserStack credentials

Saving your BrowserStack credentials as environment variables makes it easier to run your test suite from your local or CI environment.

Copy icon Copy
Copy icon Copy

Install BrowserStack SDK using Maven Archetype

Maven Archetype provides a template to quickly configure your project. Copy & run the following command on your terminal/command prompt to add browserstack-java-sdk dependency in your pom.xml and browserstack.yml config file in your project along with the required variables.

Copy icon Copy
Copy icon Copy


Please ensure that you now have at least browserstack-java-sdk v1.13.10 before proceeding.

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.

Make sure you copy the contents of the below config file and set it in your project’s browserstack.yml file:

browserstack.yml
Copy icon Copy

The projectName and buildName config must be static and not change across different runs of the same build. Different runs of the same build/job would be automatically identified by Test Observability.

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 your test suite with Test Observability

Run the following command from the project’s root directory to run your test suite with BrowserStack.

Copy icon Copy

Post build run completion, you will see the build URL of Test Observability. Alternatively, you can also navigate to your build run using Build Runs.

Visit Test Observability

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 Check Circle