1If we use JUNIT, we can use maven plugins to run tests in parallel.
2In maven-surefire-plugin, we can specify how many threads we want to open
3at the same time.
4
5<plugin>
6 <groupId>org.apache.maven.plugins</groupId>
7 <artifactId>maven-surefire-plugin</artifactId>
8 <version>2.18.1</version>
9 <configuration>
10 <parallel>classes</parallel> ==> you can choose classes or methods
11 <threadCount>5</threadCount> ==> how many browser will be launched
12 <includes>
13 <includetest1.java</include>
14 <includetest2.java</include>
15 <includetest3.java</include>
16 <includetest4.java</include>
17 </includes>
18 <testFailureIgnore>true</testFailureIgnore>
19 </configuration>
20</plugin>
21
22We also have to make some changes in Driver class. We need to use
23"ThreadLocal<WebDriver> driverPool" instead of "WebDriver driver".
24Because "WebDriver" generates only a single WebDriver object,
25whereas "ThreadLocal<WebDriver>" generates multiple browser to run
26parallel testing.
27
28In TestNG it is very easy and efficient to perform
29
1If we use JUNIT, we can use maven plugins to run tests in parallel.
2In maven-surefire-plugin, we can specify how many threads we want to open
3at the same time.
4
5<plugin>
6 <groupId>org.apache.maven.plugins</groupId>
7 <artifactId>maven-surefire-plugin</artifactId>
8 <version>2.18.1</version>
9 <configuration>
10 <parallel>classes</parallel> ==> you can choose classes or methods
11 <threadCount>5</threadCount> ==> how many browser will be launched
12 <includes>
13 <includetest1.java</include>
14 <includetest2.java</include>
15 <includetest3.java</include>
16 <includetest4.java</include>
17 </includes>
18 <testFailureIgnore>true</testFailureIgnore>
19 </configuration>
20</plugin>
21
22We also have to make some changes in Driver class. We need to use
23"ThreadLocal<WebDriver> driverPool" instead of "WebDriver driver".
24Because "WebDriver" generates only a single WebDriver object,
25whereas "ThreadLocal<WebDriver>" generates multiple browser to run
26parallel testing.
27
28In TestNG it is very easy and efficient to perform