At work we are running automated Selenium tests on a remote location (BrowserStack). This is how the remote web driver is instantiated and these tests also use testNG
and the way the project is set up is that each test passes a row number into this DriverInit
constructor and will then tests things that are on that row (that part isn't shown in the code). The problem is we don't have the money to run 100 parallel tests on BrowserStack and we are all unfamiliar with this.
After reading, it seems like AWS ec2 would be a good option but I have no idea how it works even after watching videos on it. Does ec2 have the capability of taking a project like this and running a testNG suite? What is the easiest way to do this? We don't need any of the fancy stuff that BrowserStack or SaucyLabs has. We simply need to run browser tests in the background, but we do not need to have a video recording or any testing information. We really just need the CPU power to run a lot of parallel tests remotely.
Ideally we would like to be able to just replace the URL
with another url and run tests like that if possible.
public class DriverInit{
public WebDriver driver;
public ChromeOptions chromeOptions;
public DesiredCapabilities caps;
public static final String USERNAME = "my_name";
public static final String AUTOMATE_KEY = "blah_blah_blah";
public static final String URL = "https://" + USERNAME + ":" + AUTOMATE_KEY + "@hub-cloud.browserstack.com/wd/hub";
DriverInit(int row) throws MalformedURLException {
// for BrowserStack testing
caps = new DesiredCapabilities();
caps.setCapability("os", "Windows");
caps.setCapability("os_version", "10");
caps.setCapability("browser", "Chrome");
caps.setCapability("browser_version", "80.0 beta");
caps.setCapability("browserstack.local", "false");
caps.setCapability("browserstack.selenium_version", "3.5.2");
caps.setCapability("name", "selenium test for row " + row);
this.driver = new RemoteWebDriver(new URL(URL), caps);
this.chromeOptions = new ChromeOptions();
String chromeDriverPath = "resources/chromedriver.exe";
System.setProperty("webdriver.chrome.driver", chromeDriverPath);
}