Using Selenium IDE to generate TestNG tests and run them on BrowserStack via a Jenkins Maven job

By Beerend Lauwers

It’s amazing how little professional documentation there is available for Selenium integration, especially Selenium IDE.

I’m going to assume that you already have experience with Selenium IDE, TestNG, BrowserStack and Jenkins.

Selenium IDE: Generate TestNG tests

What is it

Selenium IDE is a Firefox plugin. There’s also Selenium Builder, which will probably be used in the future. I’m still using Selenium IDE for the moment.

Generating TestNG test files

Open up Selenium IDE in Firefox and do the following:

Exporting to TestNG with Selenium IDE

Exporting to TestNG with Selenium IDE


What is it

TestNG is a Java-based test framework. It seemed a pretty sensible one, so I just picked it.


What is it

Maven is a build manager for Java projects. Jenkins has built-in support for Maven jobs, and it’s less complex than an Ant script.

Creating a Java project and rigging it up with TestNG tests

This blog post explains it quite well, so follow that first.

If it’s down, here’s a mirror: Mirror.

Interfacing with BrowserStack

The files generated by Selenium IDE assume a local Selenium instance, but we want to test with BrowserStack.

In each test, you’ll want to add the following import statements:

import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;

In the setUp() method, you will want to replace the lines

driver = new FirefoxDriver();
baseUrl = "YOUR_URL";


DesiredCapabilities capability = new DesiredCapabilities();
capability.setCapability("build", "TestNG - Sample");
driver = new RemoteWebDriver(
  new URL(""),

baseUrl = "YOUR_URL";

In the runner method (usually named the same as your class), you’ll want to add


in the appropriate location (at the start, after any String declarations).

Setting up a Maven project with the TestNG project

The aforementioned blog post also covers this.

Accessing the TestNG report via Jenkins

You’ll need the HTML Publisher Plugin for this. After installing it, go to your job configuration page and add it as a post-build action:

Selecting Publish HTML reports as a post-build action.

Selecting “Publish HTML reports” as a post-build action.

Click the “Add” button to add a report. You’ll see the following fields:

The available fields for publishing a report.

The available fields for publishing a report.

To view the checkboxes, you need to press the “Publishing options…” button (not visible in the screenshot).

When a build finishes, you’ll now get a link to the report on the left-hand side:

The newly-available report.

The newly-available report.


Really, the only special bit here is that we’re now running everything via BrowserStack. BrowerStack currently doesn’t have a complete tutorial for proper Jenkins integration, so I thought I’d write this down to get a starting document going.