eclipse - java null pointer exception in test suite -


i stuck @ situation. here have created 1 testsuite 2 test cases in it. first test case executed properly. in second test case, throws error of java.lang.nullpointerexception @ webdriver driver

test case:

 public class second{     private webdriver driver;      @test     public void sample() throws exception     {            system.out.println("tab bar");            driver.findelement(by.id("tabs"));            //my code         } } 

webdriver driver; 

is not initiated. expect? exception absolutly correct. can try following code avoid exception:

driver= new webdriver(); driver.findelement(by.id("tabs")); 

Comments