@BeforeClass does not start my tests in Webdriver, Java, and I don't know where do I go wrong
@BeforeClass
public static void setup() {
driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.get(baseUrl + "login");
driver.findElement(By.id("username")).sendKeys("myUserName");
driver.findElement(By.id("password")).sendKeys("myPassword");
driver.findElement(By.id("loginBTN")).click();
}
After the code I start the regular testing:
@Test
public void firstTest() {
//myTestCode
}
After attempting to run, all tests fail, the webdriver does not start, etc...
It would be nice to have this since I have to test a page where I have to be logged in (with @Before the webdriver starts before each test, so obviously I would need the @BeforeClass for this one.)
//This needs to be here for this to run and having this here means its only local to this method
Webdriver driver;
}
Then your Test will work
}