Posts

Showing posts with the label testng

TestNG - parallel Test execution, WebDriver nullpointer

TestNG - parallel Test execution, WebDriver nullpointer I am sure it has to be an easy one to solve but nothing comes to my mind at this moment, here is the situation. I have one Singleton class (DriverFactory.class) to set and retrieve a ThreadLocal Object. Two test classes running in parallel (FirstTestClass), (SecondTestClass) and the third TestListenerAdapter class with a method where I want to use the actual running WebDriver instance(it should be bound to the Thread) but here I am getting null pointer exception even if, here is the code import config.DriverFactory; import org.junit.Assert; import org.testng.annotations.Test; import org.openqa.selenium.WebDriver; public class SecondTestClass { WebDriver driver; public SecondTestClass()throws Exception{ DriverFactory.getInstance().setDriver(); driver = DriverFactory.getInstance().getDriver();; } @Test public void testInSecondClass() { System.out.println("n THREAD ID: " + Thread....