Skip to main content
Transform your testing process with: Real Device Features, Company-wide Licences, & App Percy

Integrate BrowserStack App Automate with TeamCity

Integrate your Appium test suite with Teamcity and the BrowserStack device cloud for native and hybrid apps using our TeamCity plugin.

Introduction

TeamCity is a Java-based build management and continuous integration server from JetBrains.

Note: Use our TeamCity plugin to integrate BrowserStack with ease.

Features

  1. Manage your BrowserStack credentials globally or per build job.
  2. Create a build step to upload your app build to the BrowserStack server.
  3. Set up and teardown BrowserStack Local for testing internal, dev or staging environments.

Installing the plugin

  1. Go to Server Administration and click Plugins List Appium Install Plugin select Plugins List

  2. Click on upload plugin zip and upload our plugin Uploading plugin zip on Team City

  3. Restart TeamCity. You should now see BrowserStack in your list of available Plugins Restart TeamCity to see BrowserStack in your list of available Plugins

Configuring projects

  1. Click on Build Features

  2. Click Add build feature and select BrowserStack from the list Choose Browserstack from Build feature list

  3. Add your BrowserStack Username and Access Key, and select the options from the form Add BrowserStack configuration

  4. Save your changes

Configuring app upload step

Next, you will need to upload your app to the BrowserStack servers and for that, you will need to configure the app upload build step. Follow these steps to configure a build step to upload your app to the BrowserStack servers:

  1. Go to Build Steps > New Build Step
  2. Select the Runner type as BrowserStack App Upload Selecting the Runner type as BrowserStack App Upload

  3. Enter the path to your app file on the local TeamCity server and click Save Enter the path to your app file on the local TeamCity server and click save

Configuring tests

Following environment variables are set by this TeamCity plugin:

BROWSERSTACK_USERNAME
BROWSERSTACK_ACCESS_KEY
BROWSERSTACK_APP_ID
BROWSERSTACK_LOCAL
BROWSERSTACK_LOCAL_IDENTIFIER

Use these environment variables to set DesiredCapabilities in your test. Here is a sample code:

String userName = System.getenv("BROWSERSTACK_USERNAME");
String accessKey = System.getenv("BROWSERSTACK_ACCESS_KEY");
String browserstackLocal = System.getenv("BROWSERSTACK_LOCAL");
String browserstackLocalIdentifier = System.getenv("BROWSERSTACK_LOCAL_IDENTIFIER");
String app = System.getenv("BROWSERSTACK_APP_ID");

public static void main(String args[]) throws MalformedURLException, InterruptedException {
    DesiredCapabilities caps = new DesiredCapabilities();
    caps.setCapability("app", app);
    caps.setCapability("device", "Samsung Galaxy S8");
    caps.setCapability("browserstack.local", browserstackLocal);
    caps.setCapability("browserstack.localIdentifier", browserstackLocalIdentifier);
}

driver = new AndroidDriver<AndroidElement>(new URL("https://"+userName+":"+accessKey+"@hub-cloud.browserstack.com/wd/hub"), caps);
userName = process.env.BROWSERSTACK_USERNAME
accessKey = process.env.BROWSERSTACK_ACCESS_KEY
browserstackLocal = process.env.BROWSERSTACK_LOCAL
browserstackLocalIdentifier = process.env.BROWSERSTACK_LOCAL_IDENTIFIER
app = process.env.BROWSERSTACK_APP_ID

var capabilities = {
 "browserstack.user" : userName,
 "browserstack.key" : accessKey,
 "app" : app,
 "device" : "Samsung Galaxy S8",
 "browserstack.local" : browserstackLocal,
 "browserstack.localIdentifier" : browserstackLocalIdentifier
}

driver = wd.promiseRemote("https://hub-cloud.browserstack.com/wd/hub");

driver
  .init(capabilities)
  //Write your code here
  .fin(function() { return driver.quit(); })
  .done();
userName = Environment.GetEnvironmentVariable("BROWSERSTACK_USERNAME");
accessKey = Environment.GetEnvironmentVariable("BROWSERSTACK_ACCESS_KEY");
browserstackLocal = Environment.GetEnvironmentVariable("BROWSERSTACK_LOCAL");
browserstackLocalIdentifier = Environment.GetEnvironmentVariable("BROWSERSTACK_LOCAL_IDENTIFIER");
app = Environment.GetEnvironmentVariable("BROWSERSTACK_APP_ID");

DesiredCapabilities caps = new DesiredCapabilities();
caps.SetCapability("browserstack.user", userName);
caps.SetCapability("browserstack.key", accessKey);
caps.SetCapability("app", app);
caps.SetCapability("device", "Samsung Galaxy S8");
caps.SetCapability("build", "MySampleBuild");
caps.SetCapability("browserstack.local", browserstackLocal);
caps.SetCapability("browserstack.localIdentifier", browserstackLocalIdentifier);

AndroidDriver<AndroidElement> driver = new AndroidDriver<AndroidElement>(new Uri("https://hub-cloud.browserstack.com/wd/hub"), caps);
$user_name = getenv("BROWSERSTACK_USERNAME");
$access_key = getenv("BROWSERSTACK_ACCESS_KEY");
$browserstack_local = getenv("BROWSERSTACK_LOCAL");
$browserstack_local_identifier = getenv("BROWSERSTACK_LOCAL_IDENTIFIER");
$app = getenv("BROWSERSTACK_APP_ID");


$capabilities = new DesiredCapabilities();
$capabilities->setCapability("device", "Samsung Galaxy S8");
$capabilities->setCapability("app", $app);
$capabilities->setCapability("build", "MySampleBuild");
$capabilities->setCapability("browserstack.local", $browserstack_local);
$capabilities->setCapability("browserstack.localIdentifier", $browserstack_local_identifier);

$driver = RemoteWebDriver::create("https://" + user_name + ":" + access_key + "@hub-cloud.browserstack.com/wd/hub", $capabilities);
user_name = os.getenv("BROWSERSTACK_USERNAME")
access_key = os.getenv("BROWSERSTACK_ACCESS_KEY")
browserstack_local = os.getenv("BROWSERSTACK_LOCAL")
browserstack_local_identifier = os.getenv("BROWSERSTACK_LOCAL_IDENTIFIER")
app = os.getenv("BROWSERSTACK_APP_ID")

desired_cap = {
    'app': app,
    'device': 'Samsung Galaxy S8',
    'browserstack.local': browserstack_local,
    'browserstack.localIdentifier': browserstack_local_identifier
}

driver = webdriver.Remote("https://" + user_name + ":" + access_key + "@hub-cloud.browserstack.com/wd/hub", desired_cap)
user_name = ENV["BROWSERSTACK_USERNAME"]
access_key = ENV["BROWSERSTACK_ACCESS_KEY"]
browserstack_local = ENV["BROWSERSTACK_LOCAL"]
browserstack_local_identifier = ENV["BROWSERSTACK_LOCAL_IDENTIFIER"]
app = ENV["BROWSERSTACK_APP_ID"]

desired_caps = {
    'app': app,
    'device': 'Samsung Galaxy S8',
    'browserstack.local': browserstack_local,
    'browserstack.localIdentifier': browserstack_local_identifier
}


appium_driver = Appium::Driver.new({
    'caps' => desired_caps,
    'appium_lib' => {
        :server_url => "https://#{user_name}:#{access_key}@hub-cloud.browserstack.com/wd/hub"
    }}, true)

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