title: FAILED CONFIGURATION: @AfterClass tear
body: <p>Iam using selenium 2.39 and Testng
  firefox version 26</p>
  
  <p>below is the code</p>
  
  <pre><code>   package Examples;
  
     import java.util.concurrent.TimeUnit;
  
     import org.junit.BeforeClass;
     import org.openqa.selenium.By;
     import org.openqa.selenium.WebDriver;
     import org.openqa.selenium.firefox.FirefoxDriver;
     import org.testng.annotations.AfterClass;
     import org.testng.annotations.DataProvider;
     import org.testng.annotations.Test;
  
     public class Example2 {
     public static WebDriver driver;
     //String ddd;
     //    public Example2() {
     //       super();
      //    }
  
  @BeforeClass
  public void beforeClass()
  {
  driver = new FirefoxDriver();
  driver.manage().timeouts().implicitlyWait(60000, TimeUnit.MILLISECONDS);
  }
  
  @Test(dataProvider="Mail Information")
  public void mailSend(String to,String subject,String body) throws Exception
  
  {
  
      driver.get("https://www.gmail.com");
      driver.findElement(By.id("Email")).sendKeys("xyzy@gmail.com");
      driver.findElement(By.id("Passwd")).sendKeys("*********");
      driver.findElement(By.id("signIn")).click();
  
      driver.findElement(By.cssSelector("div[class='T-I J-J5-Ji T-I-KE L3']")).click();
      driver.findElement(By.className("vO")).sendKeys(to);    
      driver.findElement(By.className("aoT")).sendKeys(subject);
  
      driver.findElement(By.cssSelector(".editable")).click();
      driver.switchTo().frame(driver.findElement(By.xpath("//iframe[contains(@tabindex,'1') and contains(@frameborder,'0')]"))); 
      driver.findElement(By.xpath("//body[@role='textbox']")).sendKeys(body);    
      driver.switchTo().defaultContent();       
      driver.findElement(By.cssSelector("div[class='T-I J-J5-Ji aoO T-I-atl L3']")).click();
  
      driver.navigate().refresh();
  }
  
  @DataProvider (name = "Mail Information")
  public Object[][] mailSendProvider() 
  {
      return new Object[][]
  
              {
  
              {"xyzy@gmail.com","This is a Test Mail","hello"},
              };
  
  }
  
  @AfterClass
  public void tear()
  {
      driver.quit();
     }
  }
  </code></pre>
  
  <p>unable to understand problem with the test libraries or problem with Testng Setup</p>
  
  <p>When iam running using TestNG, iam getting the following error.</p>
  
  <pre><code> [TestNG] Running:
    C:\Users\Administrator\AppData\Local\Temp\testng-eclipse-1461140969\testng-customsuite.xml
  
  FAILED CONFIGURATION: @AfterClass tear
  java.lang.NullPointerException
      at Examples.Example2.tear(Example2.java:65)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
      at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:564)
      at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
      at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)
      at org.testng.internal.TestMethodWorker.invokeAfterClassMethods(TestMethodWorker.java:225)
      at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:114)
      at org.testng.TestRunner.privateRun(TestRunner.java:767)
      at org.testng.TestRunner.run(TestRunner.java:617)
      at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
      at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
      at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
      at org.testng.SuiteRunner.run(SuiteRunner.java:240)
      at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
      at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
      at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
      at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
      at org.testng.TestNG.run(TestNG.java:1057)
      at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
      at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
      at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
  
  FAILED: mailSend("xyzy@gmail.com", "This is a Test Mail", "hello")
  java.lang.NullPointerException
      at Examples.Example2.mailSend(Example2.java:32)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
      at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
      at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
      at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
      at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
      at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
      at org.testng.TestRunner.privateRun(TestRunner.java:767)
      at org.testng.TestRunner.run(TestRunner.java:617)
      at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
      at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
      at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
      at org.testng.SuiteRunner.run(SuiteRunner.java:240)
      at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
      at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
      at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
      at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
      at org.testng.TestNG.run(TestNG.java:1057)
      at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
      at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
      at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
  
  
  ===============================================
      Default test
      Tests run: 1, Failures: 1, Skips: 0
      Configuration Failures: 1, Skips: 0
  ===============================================
  
  
  ===============================================
  Default suite
  Total tests run: 1, Failures: 1, Skips: 0
  Configuration Failures: 1, Skips: 0
  ===============================================
  
  [TestNG] Time taken by org.testng.reporters.JUnitReportReporter@267b76: 34 ms
  [TestNG] Time taken by org.testng.reporters.SuiteHTMLReporter@1ff3fcf: 145 ms
  [TestNG] Time taken by org.testng.reporters.EmailableReporter2@1799a1e: 18 ms
  [TestNG] Time taken by [FailedReporter passed=0 failed=0 skipped=0]: 17 ms
  [TestNG] Time taken by org.testng.reporters.XMLReporter@1ddcac5: 16 ms
  [TestNG] Time taken by org.testng.reporters.jq.Main@1d35bf2: 87 ms
  </code></pre>
  
  <p>Can somebody Please help me</p>