Reputation: 21
My tests are running sequentially but not parallely when I try running on LambdaTest Selenium Grid. Below is a small part of my maven pom file:
<executions>
<execution>
<id>test-chrome</id>
<phase>test</phase>
<configuration>
<env>chrome</env>
<inParallel>true</inParallel>
<nodes>4</nodes>
<specsDir>specs</specsDir>
</configuration>
<goals>
<goal>execute</goal>
</goals>
</execution>
<execution>
<id>test-firefox</id>
<phase>test</phase>
<configuration>
<env>firefox</env>
<inParallel>true</inParallel>
<nodes>4</nodes>
<specsDir>specs</specsDir>
</configuration>
<goals>
<goal>execute</goal>
</goals>
</execution>
</executions>
And I have created 2 different directory for chrome and firefox which contains a two different properties file:
chrome.properties file:
BROWSER = chrome
BROWSER_VERSION = 78
PLATFORM = WIN10
firefox.properties file:
BROWSER = firefox
BROWSER_VERSION = 69
PLATFORM = WIN8
I have using these environment variable in my java class file:
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("browserName", System.getenv("BROWSER"));
capabilities.setCapability("version", System.getenv("BROWSER_VERSION"));
capabilities.setCapability("platform", System.getenv("PLATFORM"));
Any help would be appreciated, many thanks :)
Upvotes: 1
Views: 478
Reputation: 11
Try to replace chrome.properties with this:
BROWSER = chrome (PropertyName)
BROWSER_VERSION = 78
PLATFORM = WIN10
And add driver version from the properties files or any other parameter you want to make dynamic
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<parallel>tests</parallel>
<threadCount>10</threadCount>
<systemPropertyVariables>
<propertyName>Firefox</propertyName>
<propertyName>Chrome</propertyName>
</systemPropertyVariables>
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8.8</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-firefox-driver</artifactId>
<version>2.47.1</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-chrome-driver</artifactId>
<version>2.47.1</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.47.1</version>
</dependency>
</dependencies>
Upvotes: 0