TeamCity
Integrate your Appium test suite with Fastlane 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.
Features
Manage your BrowserStack credentials globally or per build job.
Create a build step to upload your app build to the BrowserStack server.
Set up and teardown BrowserStack Local for testing internal, dev or staging environments.
Installing the Plugin
Go to Server Administration and click Plugins List
Click on upload plugin zip and upload our plugin
Restart TeamCity. You should now see BrowserStack in your list of available Plugins
Configuring Projects
Click on Build features
Click Add build feature and select BrowserStack from the list
Add your BrowserStack USERNAME and ACCESS_KEY, and select the options from the form
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:
Go to Build Steps > New Build Step
Select the Runner type as BrowserStack App Upload
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
Copy icon
Copy
Use these environment variables to set DesiredCapabilities in your test. Here is a sample code:
username = 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 = {
'device' : 'Samsung Galaxy S8' ,
'app' : app,
'browserstack.local' : browserstack_local,
'browserstack.localIdentifier' : browserstack_local_identifier
}
appium_driver = Appium::Driver.new( {
'caps' = > desired_caps,
'appium_lib' = > {
:server_url = > "https://#{username}:#{access_key}@hub-cloud.browserstack.com/wd/hub"
} } , true )
Copy icon
Copy
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( "device" , "Samsung Galaxy S8" ) ;
caps.setCapability( "app" , app) ;
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) ;
Copy icon
Copy
username = 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 = {
'device' : 'Samsung Galaxy S8' ,
'app' : app,
'browserstack.local' : browserstack_local,
'browserstack.localIdentifier' : browserstack_local_identifier,
'browserstack.user' : username,
'browserstack.key' : access_key
}
driver = webdriver.Remote( "https://" + userName + ":" + accessKey + "@hub-cloud.browserstack.com/wd/hub" , desired_cap)
Copy icon
Copy
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,
"device" : "Samsung Galaxy S8" ,
"app" : app,
"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( ) ;
Copy icon
Copy
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( "device" , "Samsung Galaxy S8" ) ;
caps.SetCapability( "app" , app) ;
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) ;
Copy icon
Copy
$username = getenv( "BROWSERSTACK_USERNAME" ) ;
$accessKey = getenv( "BROWSERSTACK_ACCESS_KEY" ) ;
$browserstackLocal = getenv( "BROWSERSTACK_LOCAL" ) ;
$browserstackLocalIdentifier = 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" , $browserstackLocal ) ;
$capabilities -> setCapability( "browserstack.localIdentifier" , $browserstackLocalIdentifier ) ;
$driver = RemoteWebDriver::create( "https://hub-cloud.browserstack.com/wd/hub" , $capabilities ) ;
Copy icon
Copy
Is this page helping you?
Thank you for your valuable feedback!