I am new to learning Selenium WebDriver and testNG. I was trying to learn some testNG annotations via below set of test cases, however one test case is always failing and I could not figure out what the error is?
Also, I tried to search in the existing question but could not find which matches with my issue. So here I'll explain what I am trying to achieve:
- I have created three classes which contains - testNGannotations test cases. Classes names are:- testingNG,- testingNG1and- testingNG2.
- Then I have created a testNg xml file so that these test cases can be executed as a suit. 
- I have also created one properties file ( - paths.properties) which stores some xpaths which I want to use in- test2of- testingNGclass.
- When I am running this xml file as a suit, - test2of- testingNGclass is always failing, however eclipse do not show any syntax error and I could not understand what the issue is.
First class:testigNG
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;
import org.openqa.selenium.By;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
public class testingNG {
    @Test
    public void test1()
    {
        System.out.println("first NG test case");
    }
    @Test
    public void test2() throws IOException, InterruptedException
    {
        Properties pro=new Properties();
        FileInputStream fis= new FileInputStream (System.getProperty("C:\\Users\\SumitKumar.Dubey\\workspace\\My_testNG\\src\\paths.properties"));
        pro.load(fis);
        System.out.println("Login link xpath: "+pro.getProperty("DLJ_Login_Button"));
        FirefoxDriver driver=new FirefoxDriver();
        driver.get("http://www.dsij.in/");
        driver.findElement(By.xpath(pro.getProperty("DLJ_Login_Button"))).click();
        Thread.sleep(3000);
        driver.findElement(By.xpath(pro.getProperty("DLJ_Login_Username"))).sendKeys("dubey_sumit");
        driver.findElement(By.xpath(pro.getProperty("DLJ_Login_Pwd"))).sendKeys("0VUoUEMGpiC");
        driver.findElement(By.xpath(pro.getProperty("DLJ_click_login"))).click();
    }
}
Second class: testingNG1
=========================
import org.testng.annotations.Test;
public class testingNG1 {
    @Test
    public void test4()
    {
        System.out.println("fourth NG test case from testNG1 class");
    }
}
Third class: testingNG2
import java.io.Console;
import org.openqa.selenium.By;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.AfterTest;
import org.testng.annotations.Test;
public class testingNG2 {
    FirefoxDriver driver=new FirefoxDriver();
    @Test (priority=1)
    public void site_navigate()
    {
        driver.get("http://demoqa.com/");
        System.out.println("print when ulr is entered!");
    }
    @Test (priority=2)
    public void click_about_us()
    {
        driver.findElement(By.xpath("//a[@href='http://demoqa.com/about-us/']")).click();
        System.out.println("print when ulr is entered!");
        //driver.getPageSource().contains("About us");  
        if(driver.getPageSource().contains("About us"))
        {
        System.out.println("Text is Present");
        }
        else
        {
        System.out.println("Text is not Present");
        }
    }
    @AfterTest
    public void close_browser()
    {
        driver.close();
        driver.quit();
    }
}
testNG xml file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite">
  <test name="Test1">
    <classes>
      <class name="testingNG1"/>
    </classes>
  </test>
  <test name="Test2">
    <classes>
      <class name="testingNG2"/>
    </classes>
  </test>
  <test name="Test3">
    <classes>
      <class name="testingNG"/>
    </classes>
  </test>
</suite> <!-- Suite -->
paths.properties file:
#Dalal Street Login
DLJ_Login_Button=//a[@id='dnn_dnnLogin_enhancedLoginLink']
DLJ_Login_Username=//input[@id='dnn_ctr5070_Login_Login_DNN_txtUsername']
DLJ_Login_Pwd=//input[@id='dnn_ctr5070_Login_Login_DNN_txtPassword']
DLJ_click_login=//input[@id='dnn_ctr5070_Login_Login_DNN_cmdLogin']
Here test2 of testingNG class is failing which uses the properties file.
 
    