Fastlane
Integrate your Appium test suite with Fastlane and the BrowserStack device cloud for native and hybrid apps using our Fastlane plugin.
Introduction
Fastlane is a tool to automate beta deployments and releases for iOS and Android apps. It handles tasks like generating screenshots, dealing with code signing, and releasing applications, etc. Add BrowserStack to the mix, and your mobile apps can be tested across 1100+ real devices. BrowserStack lets you integrate your Appium tests with Fastlane using a plugin that will allow you to upload your app to the BrowserStack servers and test on the BrowserStack real device cloud.
Getting Started
Install plugin:
Add BrowserStack’s Fastlane plugin by executing the below command:
fastlane add_plugin browserstack
You can easily upload your app using BrowserStack Fastlane Plugin and execute your test on the BrowserStack cloud. In order to configure the plugin add below action in your Fastfile. You can also refer to the sample android project, which demonstrates the use of this plugin.
upload_to_browserstack_app_automate(
browserstack_username: ENV["BROWSERSTACK_USERNAME"],
browserstack_access_key: ENV["BROWSERSTACK_ACCESS_KEY"],
file_path: "<path_to_your_apk_or_ipa_file>",
custom_id: "<custom_id_name>"
)
Note: custom_id is optional. You can upload multiple builds under the same custom_id. Use custom_id in the app
capability for Appium to always pick the last uploaded build. The file_path parameter is not required if the app was built in the same lane with the help of the Gradle or Gym plugin.
Once the app upload is successful, the app id of the app will be stored in an environment variable “BROWSERSTACK_APP_ID” and it can be accessed in your tests in the following way :
userName = ENV['BROWSERSTACK_USERNAME']
access_key = ENV['BROWSERSTACK_ACCESS_KEY']
desired_caps = {
'device': 'Samsung Galaxy S8',
'app': ENV["BROWSERSTACK_APP_ID"],
'build': 'MyBuild'
}
appium_driver = Appium::Driver.new({
'caps' => desired_caps,
'appium_lib' => {
:server_url => "https://#{username}:#{access_key}@hub-cloud.browserstack.com/wd/hub"
}}, true)
String username = System.getenv("BROWSERSTACK_USERNAME");
String accessKey = System.getenv("BROWSERSTACK_ACCESS_KEY");
public static void main(String args[]) throws MalformedURLException, InterruptedException {
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("device", "Samsung Galaxy S8");
caps.setCapability("app", System.getenv("BROWSERSTACK_APP_ID");
caps.setCapability("build", "MyBuild");
}
driver = new AndroidDriver(new URL("https://"+userName+":"+accessKey+"@hub-cloud.browserstack.com/wd/hub"), caps);
username = os.getenv("BROWSERSTACK_USERNAME")
access_key = os.getenv("BROWSERSTACK_ACCESS_KEY")
app =
desired_cap = {
'device': 'Samsung Galaxy S8',
'app': os.getenv("BROWSERSTACK_APP_ID"),
'build': 'MyBuild'
}
driver = webdriver.Remote("https://" + userName + ":" + accessKey + "@hub-cloud.browserstack.com/wd/hub", desired_cap)
username = process.env.BROWSERSTACK_USERNAME
accessKey = process.env.BROWSERSTACK_ACCESS_KEY
var capabilities = {
"device" : "Samsung Galaxy S8",
"app" : process.env.BROWSERSTACK_APP_ID,
"build" : "MyBuild"
}
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");
DesiredCapabilities caps = new DesiredCapabilities();
caps.SetCapability("device", "Samsung Galaxy S8");
caps.SetCapability("app", Environment.GetEnvironmentVariable("BROWSERSTACK_APP_ID");
caps.SetCapability("build", "MySampleBuild");
AndroidDriver driver = new AndroidDriver(new Uri("https://hub-cloud.browserstack.com/wd/hub"), caps);
$username = getenv("BROWSERSTACK_USERNAME");
$accessKey = getenv("BROWSERSTACK_ACCESS_KEY");
$app = getenv("BROWSERSTACK_APP_ID");
$capabilities = new DesiredCapabilities();
$capabilities->setCapability("device", "Samsung Galaxy S8");
$capabilities->setCapability("app", $app);
$capabilities->setCapability("build", "MySampleBuild");
$driver = RemoteWebDriver::create("https://hub-cloud.browserstack.com/wd/hub", $capabilities);
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
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!