Skip to content

Instantly share code, notes, and snippets.

package WithThreadLocal;
import java.net.*;
import java.net.URL;
import java.util.HashMap;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeOptions;
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd">
<suite name="Suite">
<test thread-count="2" name="Test" parallel="methods">
<classes>
<class name="WithThreadLocal.TestLambdaTestPlayground" />
<class name="WithThreadLocal.TestLambdaTestEcommerce" />
</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->
package WithThreadLocal;
import org.testng.annotations.Test;
public class TestLambdaTestEcommerce extends BaseTest {
@Test
public void testLambdaTestEcommerce() {
System.out.println("<- TestLambdaTestEcommerce -> Executed by Thread : " + Thread.currentThread().getId()
package WithThreadLocal;
import org.testng.annotations.Test;
public class TestLambdaTestPlayground extends BaseTest {
@Test
package WithThreadLocal;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.*;
public class BaseTest {
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd">
<suite name="Suite">
<test thread-count="2" name="Test" parallel="methods">
<classes>
<class name="WithoutThreadLocal.TestLambdaTestPlayground" />
<class name="WithoutThreadLocal.TestLambdaTestEcommerce" />
</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->
package WithoutThreadLocal;
import org.testng.annotations.Test;
public class TestLambdaTestEcommerce extends BaseTest {
@Test
package WithoutThreadLocal;
import org.testng.annotations.Test;
public class TestLambdaTestPlayground extends BaseTest {
@Test
package WithoutThreadLocal;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.*;
public class BaseTest {
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>ThreadLocal</groupId>
<artifactId>ThreadLocal</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>SeleniumThreadLocal</name>
<dependencies>
<dependency>