下面的代码示例返回一个null pointer exception
. 这是为什么?
public class JunitCheck {
WebDriver driver;
public String baseURL = null;
@Before
public void setUp() throws Exception {
baseURL = "https://www.google.com";
}
@After
public void tearDown() throws Exception {
}
@Test
public void test() {
driver = new FirefoxDriver();
driver.get(baseURL);
System.out.println(baseURL);
}