Sunday, 29 June 2014

Test NG With Selenium

What is Test NG ? :We are using Test NG with Selenium For execution of multiple test cases and generate the XSLT report format . Test NG is an Open Source Automated Testing framework , where NG of Test NG means Next Generation . Test NG is similar to Junit but its not a Junit extension. It is designed to better than Junit.


Feature of Test NG -

  1. Test NG uses more java and OO feature.
  2. Annotation.
  3. It is flexible with testing integrated classes. It means we don't need to create new test classes instance for every test method.

How To configure Test NG with selenium :

  1. Open the Eclipse.
  2. Go to the Help> Install New Software > Add and give the name of the plug in is Test NG and Enter the url: http://beust.com/eclipse
  3. Install the Test NG with eclipse.


    How can we run Test NG with Eclipse:

1.create a new package in your Project src folder.
2. create a new class in new created package.


@Test
public void TestcasesName()
{

// Here you can write your test cases .
baseurl = "http://google.com";
FirefoxDriver driver = new FirefoxDriver();
driver.get(baseurl);
if(driver.getTitle().contains("Google"))
System.out.println("Test passed");
else
System.out.println("Test Failed");

}
Note :
  1. When we are using first time Test NG the we are add the Test NG library into the @Test .
  2. Import the Test(import org.testng.annotations.Test;) into the @Test.
  3. Run The java Program Test with Test NG.
  4. Find the all test result with summary.

Show the summary report:

  1. Refresh the java project. And test output folder is visible at the bottom of the project Explorer.
  2. Open the index.html file from test output folder

No comments:

Post a Comment