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.


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

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


  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 tc_1

  2. Click on upload plugin zip and upload our plugin tc_2

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

Configuring projects

  1. Click on Build Features

  2. Click Add build feature and select BrowserStack from the list tc_4

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

  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 tc_6

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

Configuring tests

Following environment variables are set by this TeamCity plugin:


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+""), 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("");

  //Write your code here
  .fin(function() { return driver.quit(); })
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(""), 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 + "", $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 + "", desired_cap)
browserstack_local = ENV["BROWSERSTACK_LOCAL"]
browserstack_local_identifier = ENV["BROWSERSTACK_LOCAL_IDENTIFIER"]

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

appium_driver ={
    'caps' => desired_caps,
    'appium_lib' => {
        :server_url => "https://#{user_name}:#{access_key}"
    }}, 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?


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

Talk to automation expert