title: Selenium test not failing correctly - Pass with configuration fail rather than "proper" fail
body: <p>Hi I'm still newbie to Selenium/Scripting/Java and I'me still at the stage of hacking together code from elsewhere to get stuff work( tutorials and recorders mainly)</p>
  
  <p>Anyway Im trying to write a script to check a particular 'element' is present (I will want to the the reverse as well) I can get the script to pass correctly when it finds the 'element' but if change the element details so I know it should fail (as it don't exist) TestNG still pass's the test but gives a configuration fail ? </p>
  
  <p>I presume I'm missing something to cover the fail aspect of the test but no sure how to go about it, every time I try I and get it to run into this.</p>
  
  <pre><code>package Links;
  
  import org.testng.annotations.*;
  import static org.testng.Assert.*;
  import org.openqa.selenium.*;
  import org.openqa.selenium.firefox.FirefoxDriver;
  
  public class TestArea {
      private WebDriver driver;
      private StringBuffer verificationErrors = new StringBuffer();
  
  @BeforeClass(alwaysRun = true)
  public void setUp() throws Exception {
      System.setProperty("webdriver.gecko.driver", "C:\\Automation\\SeleniumFiles\\Browser Drivers\\geckodriver.exe");
      driver = new FirefoxDriver();
  
  }
  
  @Test
  public void Example() throws Exception {
      driver.get(
              "http://MyWebsite");
      try {
          assertTrue(isElementPresent(
                  By.xpath("The Element I want look for ")));
  
      } catch (Error e) {
          verificationErrors.append(e.toString());
      }
  }
  // -------------------------------------------------------------------------------------
  
  @AfterClass(alwaysRun = true)
  public void tearDown() throws Exception {
      driver.quit();
      String verificationErrorString = verificationErrors.toString();
      if (!"".equals(verificationErrorString)) {
          fail(verificationErrorString);
      }
  }
  
  private boolean isElementPresent(By by) {
      try {
          driver.findElement(by);
          return true;
      } catch (NoSuchElementException e) {
          return false;
      }
  }
  }
  </code></pre>
  
  <p>An example of a "passed" test but with a failed configuration.</p>
  
  <blockquote>
    <p>FAILED CONFIGURATION: @AfterClass tearDown java.lang.AssertionError:
    java.lang.AssertionError: expected [true] but found [false]   at
    org.testng.Assert.fail(Assert.java:96)    at
    Links.TestArea.tearDown(TestArea.java:39)     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:124)
      at
    org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:59)
      at
    org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:455)
      at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:222)
      at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:142)
      at
    org.testng.internal.TestMethodWorker.invokeAfterClassMethods(TestMethodWorker.java:214)
      at
    org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
      at org.testng.TestRunner.privateRun(TestRunner.java:648)    at
    org.testng.TestRunner.run(TestRunner.java:505)    at
    org.testng.SuiteRunner.runTest(SuiteRunner.java:455)  at
    org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450)  at
    org.testng.SuiteRunner.privateRun(SuiteRunner.java:415)   at
    org.testng.SuiteRunner.run(SuiteRunner.java:364)  at
    org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)  at
    org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84)   at
    org.testng.TestNG.runSuitesSequentially(TestNG.java:1208)     at
    org.testng.TestNG.runSuitesLocally(TestNG.java:1137)  at
    org.testng.TestNG.runSuites(TestNG.java:1049)     at
    org.testng.TestNG.run(TestNG.java:1017)   at
    org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:114)
      at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
      at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)</p>
    
    <p>PASSED: Example</p>
    
    <p>===============================================
        Default test
        Tests run: 1, Failures: 0, Skips: 0</p>
    
    <h1>    Configuration Failures: 1, Skips: 0</h1>
    
    <p>=============================================== Default suite Total tests run: 1, Failures: 0, Skips: 0 Configuration Failures: 1, Skips:</p>
    
    <h1>0</h1>
  </blockquote>
  
  <p>I don't get the configuration issue when the test can find the element.</p>
  
  <p>Thanks very much in advance</p>