×
Find plugins

BrowserStack1.0.10Minimum Jenkins requirement: 1.580.1ID: browserstack-integration

Installs: 445
Last released: 24 days ago
Maintainers
BrowserStack Support
BrowserStack Integrations

This plugin allows you to integrate with BrowserStack.

Features

  1. Manage your BrowserStack credentials globally or per build job.
  2. Set up and tear down BrowserStack Local for testing internal, dev or staging environments.
  3. Embed BrowserStack Automate reports in your Jenkins job results.

Requirements

  1. Minimum Jenkins version supported is 1.580.1.
  2. For viewing BrowserStack Automate report in your Jenkins test results.
    1. Project must be a Java project.
    2. Project must be built with maven and use either TestNG or JUnit for testing.
    3. Jenkin's JUnit plugin must be installed.

Configuring tests

This step is required for viewing the BrowserStack Automate Report in your Jenkins job results. Currently, JUnit and TestNG maven based projects are supported. Add the following dependencies to your pom.xml file:

<dependency>
    <groupId>com.browserstack</groupId>
    <artifactId>automate-testassist</artifactId>
    <version>0.7.2-SNAPSHOT</version>
</dependency>

Add the following repositories to your pom.xml file:

<repositories>
  <repository>
    <id>sonatype-nexus-snapshots</id>
    <url>https://oss.sonatype.org/content/repositories/snapshots</url>
  </repository>
</repositories>

<pluginRepositories>
  <pluginRepository>
   <id>sonatype-nexus-snapshots</id>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
  </pluginRepository>
</pluginRepositories>

Add the following plugin to your pom.xml file:

<build>
    <plugins>
      <plugin>
        <groupId>com.browserstack</groupId>
        <artifactId>automate-maven-plugin</artifactId>
        <version>0.7.2-SNAPSHOT</version>
        <configuration>
            <source>${jdk.source.version}</source>
            <target>${jdk.target.version}</target>
            <complianceLevel>${jdk.source.version}</complianceLevel>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>test-compile</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
</build>

You must define the maven properties, jdk.source.version and jdk.target.version to match the Java versions of your project.

Following environment variables are set by this Jenkins plugin:

BROWSERSTACK_USER
BROWSERSTACK_ACCESSKEY
BROWSERSTACK_LOCAL
BROWSERSTACK_LOCAL_IDENTIFIER

You can use these environment variables to set DesiredCapabilities in your test. For e.g:

String username = System.getenv("BROWSERSTACK_USER");
String accessKey = System.getenv("BROWSERSTACK_ACCESSKEY");
String browserstackLocal = System.getenv("BROWSERSTACK_LOCAL");
String browserstackLocalIdentifier = System.getenv("BROWSERSTACK_LOCAL_IDENTIFIER");

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("os", "Windows");
capabilities.setCapability("browser", "chrome");
capabilities.setCapability("browserstack.local", browserstackLocal);
capabilities.setCapability("browserstack.localIdentifier", browserstackLocalIdentifier);
driver = new RemoteWebDriver(new URL("https://" + username + ":" + accessKey + "@hub.browserstack.com/wd/hub"), capabilities);

Global Configuration

BrowserStack Credentials

To configure BrowserStack credentials globally follow these steps,

  1. Go to Manage Jenkins > Configure System.
  2. Under the BrowserStack section click on the Add button next to BrowserStack Credentials.
    1. In the global section there is an additional option, that if checked allows the plugin to collect anonymous usage data.
  3. Enter your BrowserStack username and access key which you can find on your BrowserStack Account Settings page. 
  4. Save your changes.

Job Configuration

Create a new Jenkins job or edit the configuration of an existing one. Before you can edit/add job configuration you will need to ensure that you have the necessary privileges on your Jenkins instance to add/modify jobs.

BrowserStack Credentials

  1. Under the Build Environment section check the box next to BrowserStack.
  2. If you have previously saved any global credentials these will be automatically selected.
  3. If you have not previously saved any global credentials or wish to override credentials for this job you can do so by clicking on Add.
  4. The BrowserStack Credentials screen will show up again where you can enter your BrowserStack username and access key.

BrowserStack Local

BrowserStack Local Testing allows you to test your private and internal servers, alongside public URLs, using the BrowserStack cloud, which has support for firewalls, proxies and Active Directory. The plugin is responsible for downloading the binary for the platform that the build job is running on and starting and tearing down the secure tunnel.

BrowserStack Local can only be configured per job and not via the global configuration.

To enable BrowserStack Local follow these steps,

  1. Under the Build Environment section check the box next to BrowserStack Local.
  2. If the binary is externally downloaded then set the path to the binary in the config path, BrowserStack Local Path.
  3. Downloading the binary is not necessary and if this option is left empty the plugin will automatically download the binary. This is recommended especially if you are using Jenkin's in master-slave configurations, since the plugin will download the appropriate binary for the build agent OS.
  4. You can set additional options for the binary in the BrowserStack Local Options.

Embedded Test Reports

To have BrowserStack Automate reports show up right next to the JUnit/TestNG reports in Jenkins you must follow these steps,

  1. Click on Add post-build Action under the Post-build Actions section.
  2. Click on Additional test report features.
  3. Check the box next to Embed BrowserStack Report.

DONE! This will ensure that once the build runs, the BrowserStack Automate report will show up right next to the stack trace of a failed unit test.

Note: Although stable, this plugin is a work in progress. Please send issues or feedback to support@browserstack.com.

ChangeLog

Version 1.0.7 (Nov 03 2016)

  • Fixed security bug.

Version 1.0.3 (Jul 29 2016)

  • Minor fix to analytics.

Version 1.0.2 (Jul 14 2016)

  • Fixed broken url in pom.xml for plugin wiki.

Version 1.0.1 (Jul 13 2016)

  • Fixed typos and pom.xml.

Version 1.0.0 (Jul 12 2016)

  • Initial release of plugin.
ArchivesGet past versions
Labels