High scale Chrome & Firefox testing
A guide to running large scale functional tests on Chrome and Firefox browsers using High Scale Testing on BrowserStack Automate
Introduction
High Scale Testing is a new offering from BrowserStack that gives you instant access to a large scale grid of Chrome & Firefox browsers. As leading engineering teams shift testing earlier in their release process, they need a way to run tests more quickly and reliably in their CI/CD pipelines using BrowserStack. This new offering aims to make that possible by enabling hundreds/thousands of tests to run in parallel on Chrome & Firefox browsers at a cost-effective price point.
Request access for this offering
The high scale testing product is currently available in beta and available on request. We encourage you to try it out for free.
Integrate your test suite
Migrating your existing tests to run on BrowserStack Automate - High Scale testing, is simple. In this guide, you will learn to authenticate your test session, use the desired capabilities in your tests, and run tests on the browsers in our cloud.
Configure authentication
For any tests to run on BrowserStack, you need to pass the BrowserStack credentials, username and access key. Post authentication, you can access your test sessions on the Automate dashboard.
Use the following sample code snippets to understand how to use the credentials in your test script. For example:
public static final String USERNAME = "YOUR_USERNAME";
public static final String AUTOMATE_KEY = "YOUR_ACCESS_KEY";
public static final String URL = "https://" + USERNAME + ":" + AUTOMATE_KEY + "@hub-ft.browserstack.com/wd/hub";
var userName = "YOUR_USERNAME";
var accessKey = "YOUR_ACCESS_KEY"
var browserstackURL = 'https://' + userName + ':' + accessKey + '@hub-ft.browserstack.com/wd/hub';
string USERNAME = "YOUR_USERNAME";
string AUTOMATE_KEY = "YOUR_ACCESS_KEY";
$USERNAME = "YOUR_USERNAME";
$AUTOMATE_KEY = "YOUR_ACCESS_KEY";
$BROWSERSTACK_URL = "https://$USERNAME:$AUTOMATE_KEY@hub-ft.browserstack.com/wd/hub";
BROWSERSTACK_URL = 'https://YOUR_USERNAME:YOUR_ACCESS_KEY@hub-ft.browserstack.com/wd/hub'
USERNAME = "YOUR_USERNAME"
AUTOMATE_KEY = "YOUR_ACCESS_KEY"
browserstack_url = "https://" + USERNAME + ":" + AUTOMATE_KEY + "@hub-ft.browserstack.com/wd/hub"
my $USERNAME = "YOUR_USERNAME";
my $AUTOMATE_KEY = "YOUR_ACCESS_KEY";
my $BROWSERSTACK_URL = "$USERNAME:$AUTOMATE_KEY\@hub-ft.browserstack.com";
Configure capabilities in your script
- Supports the latest three stable versions and the beta version of Chrome and Firefox browsers. The older browser versions are not supported and mustn’t be used.
- Doesn’t provide operating system selection, we automatically run your tests on Windows 10 or newer macOS versions.
Capabilities (or desired capabilities) are options that let you define the device-browser configurations that will be used to run your tests.
Consider an example where you want to run your tests on latest stable Chrome version. Use the following code snippets to learn how to set capabilities in your tests.
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("browser", "Chrome");
caps.setCapability("browser_version", "latest");
caps.setCapability("name", "My First Test");
caps.setCapability("build", "High scale build 1");
caps.setCapability("project", "Sample sandbox project");
var capabilities = {
'browserName': 'Chrome',
'browser_version': 'latest',
'name': 'My First Test',
'build': 'High scale build 1',
'project': 'Sample sandbox project'
}
IWebDriver driver;
// for Chrome
OpenQA.Selenium.Chrome.ChromeOptions capability = new OpenQA.Selenium.Chrome.ChromeOptions();
// for Firefox
OpenQA.Selenium.Firefox.FirefoxOptions capability = new OpenQA.Selenium.Firefox.FirefoxOptions();
// for Safari
OpenQA.Selenium.Safari.SafariOptions capability = new OpenQA.Selenium.Safari.SafariOptions();
capability.AddAdditionalCapability("browser", "Chrome", true);
capability.AddAdditionalCapability("browser_version", "latest", true);
capability.AddAdditionalCapability("browserstack.user", "YOUR_USERNAME", true);
capability.AddAdditionalCapability("browserstack.key", "YOUR_ACCESS_KEY", true);
capability.AddAdditionalCapability("name", "My First Test", true);
capability.AddAdditionalCapability("build", "Build #1", true);
capability.AddAdditionalCapability("project", "Sample sandbox project", true);
desired_cap = {
'browser': 'Chrome',
'browser_version': 'latest',
'name': 'My First Test',
'build': 'High scale build 1',
'project': 'Sample sandbox project',
}
$caps = array(
'browser' => 'Chrome',
'browser_version' => 'latest',
'name' => 'My First Test',
'build' => 'High scale build 1',
'project' => 'Sample sandbox project'
);
caps = Selenium::WebDriver::Remote::Capabilities.new
caps['browser'] = 'Chrome'
caps['browser_version'] = 'latest'
caps['name'] = 'My First Test'
caps['build'] = 'High scale build 1'
caps['project'] = 'Sample sandbox project'
my $caps = {
'browser' => 'Chrome',
'browser_version' => 'latest',
'name' => 'My First Test',
'build' => 'High scale build 1',
'project' => 'Sample sandbox project'
};
Run your tests on BrowserStack
- Hub URL for High Scale testing:
https://hub-ft.browserstack.com/wd/hub
- Hub URL for Cross-browser & device testing:
https://hub.browserstack.com/wd/hub
After you configure authentication and set the capabilities, the next step is to configure the test scripts to run on the remote browser.
If you were running tests on your local machine until now, you need to edit your test script to start using a remote WebDriver along with your desired capabilities.
The remote webdriver must be initialized with the High Scale Testing hub URL, https://hub-ft.browserstack.com/wd/hub, in your test script.
Use the following sample test scripts to see how remote webdriver is initialized along with the desired capabilities:
import org.openqa.selenium.By;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import java.net.URL;
public class BrowserStackSampleTest {
public static final String USERNAME = "YOUR_USERNAME";
public static final String AUTOMATE_KEY = "YOUR_ACCESS_KEY";
public static final String URL = "https://" + USERNAME + ":" + AUTOMATE_KEY + "@hub-ft.browserstack.com/wd/hub";
public static void main(String[] args) throws Exception {
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("browser", "Chrome");
caps.setCapability("browser_version", "latest");
caps.setCapability("name", "My First Test");
caps.setCapability("build", "High scale build 1");
caps.setCapability("project", "Sample sandbox project");
WebDriver driver = new RemoteWebDriver(new URL(URL), caps);
driver.get("https://www.google.com");
// Your test script like you usually write
driver.quit();
}
}
var webdriver = require('selenium-webdriver');
var userName = "YOUR_USERNAME";
var accessKey = "YOUR_ACCESS_KEY"
var browserstackURL = 'https://' + userName + ':' + accessKey + '@hub-ft.browserstack.com/wd/hub';
var capabilities = {
'browserName': 'Chrome',
'browser_version': 'latest',
'name': 'My First Test',
'build': 'High scale build 1',
'project': 'Sample sandbox project'
}
var driver = new webdriver.Builder().
usingServer(browserstackURL).
withCapabilities(capabilities).
build();
driver.get('https://www.google.com').then(function() {
// Your test script like you usually write
driver.quit();
});
using System;
using OpenQA.Selenium;
using OpenQA.Selenium.Remote;
namespace SeleniumTest {
class Program {
static void Main(string[] args) {
string USERNAME = "YOUR_USERNAME";
string AUTOMATE_KEY = "YOUR_ACCESS_KEY";
OpenQA.Selenium.Chrome.ChromeOptions capability = new OpenQA.Selenium.Chrome.ChromeOptions();
// for Firefox
// OpenQA.Selenium.Firefox.FirefoxOptions capability = new OpenQA.Selenium.Firefox.FirefoxOptions();
// for Safari
// OpenQA.Selenium.Safari.SafariOptions capability = new OpenQA.Selenium.Safari.SafariOptions();
capability.AddAdditionalCapability("browser", "Chrome", true);
capability.AddAdditionalCapability("browser_version", "latest", true);
capability.AddAdditionalCapability("browserstack.user", USERNAME, true);
capability.AddAdditionalCapability("browserstack.key", AUTOMATE_KEY, true);
capability.AddAdditionalCapability("name", "My First Test", true);
capability.AddAdditionalCapability("build", "Build #1", true);
capability.AddAdditionalCapability("project", "Sample sandbox project", true);
IWebDriver driver;
driver = new RemoteWebDriver(
new Uri("https://browsers.browserstack.com/wd/hub/"), caps
);
driver.Navigate().GoToUrl("https://www.google.com");
// Your test script like you usually write
driver.Quit();
}
}
}
<?php
require_once('vendor/autoload.php');
use Facebook\WebDriver\Remote\RemoteWebDriver;
use Facebook\WebDriver\WebDriverBy;
$USERNAME = "YOUR_USERNAME";
$AUTOMATE_KEY = "YOUR_ACCESS_KEY";
$BROWSERSTACK_URL = "https://$USERNAME:$AUTOMATE_KEY@hub-ft.browserstack.com/wd/hub";
$caps = array(
'browser' => 'Chrome',
'browser_version' => 'latest',
'name' => 'My First Test',
'build' => 'High scale build 1',
'project' => 'Sample sandbox project'
);
$web_driver = RemoteWebDriver::create(
$BROWSERSTACK_URL,
$caps
);
$web_driver->get("https://google.com");
// Your test script like you usually write
$web_driver->quit();
from selenium import webdriver
BROWSERSTACK_URL = 'https://YOUR_USERNAME:YOUR_ACCESS_KEY@hub-ft.browserstack.com/wd/hub'
desired_cap = {
'browser': 'Chrome',
'browser_version': 'latest',
'name': 'My First Test',
'build': 'High scale build 1',
'project': 'Sample sandbox project',
}
driver = webdriver.Remote(
command_executor=BROWSERSTACK_URL,
desired_capabilities=desired_cap
)
driver.get("https://www.google.com")
# Your test script like you usually write
driver.quit()
require 'rubygems'
require 'selenium-webdriver'
caps = Selenium::WebDriver::Remote::Capabilities.new
USERNAME = 'YOUR_USERNAME'.freeze
AUTOMATE_KEY = 'YOUR_ACCESS_KEY'.freeze
browserstack_url = 'https://' + USERNAME + ':' + AUTOMATE_KEY + '@hub-ft.browserstack.com/wd/hub'
caps['browser'] = 'Chrome'
caps['browser_version'] = 'latest'
caps['name'] = 'My First Test'
caps['build'] = 'High scale build 1'
caps['project'] = 'Sample sandbox project'
driver = Selenium::WebDriver.for(:remote,
url: browserstack_url,
desired_capabilities: caps)
driver.navigate.to 'https://www.google.com'
# Your test script like you usually write
driver.quit
use Selenium::Remote::Driver;
my $USERNAME = "YOUR_USERNAME";
my $AUTOMATE_KEY = "YOUR_ACCESS_KEY";
my $BROWSERSTACK_URL = "$USERNAME:$AUTOMATE_KEY\@hub-ft.browserstack.com";
my $caps = {
'browser' => 'Chrome',
'browser_version' => 'latest',
'name' => 'My First Test',
'build' => 'High scale build 1',
'project' => 'Sample sandbox project'
};
my $driver = new Selenium::Remote::Driver('remote_server_addr' => $BROWSERSTACK_URL,
'port' => '80', 'extra_capabilities' => $caps);
$driver->get('https://www.google.com');
# Your test script like you usually write
$driver->quit();
driver.quit()
statement is required, otherwise the test continues to execute, leading to a timeout.
Test privately hosted websites
BrowserStack has a feature called Local testing, using which you can make the remote browsers of BrowserStack access your privately hosted websites. Refer documentation to setup up Local testing in the language/framework of your choice.
How to migrate if you are using one of the test frameworks?
- Hub URL for High Scale testing:
https://hub-ft.browserstack.com/wd/hub
- Hub URL for Cross-browser & device testing:
https://hub.browserstack.com/wd/hub
We have extensive documentation covering all the major test frameworks. Follow the steps below to migrate your test cases to run on BrowserStack:
- Go to the getting-started page of your selected framework. (Note: Select the framework of your choice using the blue modal on the left sidebar, if not already done)
- Clone the repository for any framework (not language). A link to the repository can be seen at the beginning of the page.
- Follow the instructions in the repo’s readme to run the sample single/parallel/local tests using the framework.
- Next, you can start migrating your test cases in the structure of the repository which already has the basic code written to communicate with BrowserStack.
Even if the framework you are looking for is not listed, you can still go ahead and test using BrowserStack. Any tests for the framework that run in your local setup will run on BrowserStack. You can always reach out to our support team for any additional help.
Do not worry if you do not find your framework listed. You can reach out to our support team and we assure you that if your framework is Selenium based and works locally, then you will be able to run your tests on BrowserStack as well.
Next Steps
- Learn more about migrating your tests
- Run tests in parallel
- Learn how to set debugging options
- Mark tests as passed or failed
Feedback
For any feedback or questions, please reach out to us at support@browserstack.com.
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
- RESOURCES
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!