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 -
- Test NG uses more java and OO feature.
- Annotation.
- 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 :
- Open the Eclipse.
- 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
- 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
:
- When we are using first time Test NG the we are add the Test NG library into the @Test .
- Import the Test(import org.testng.annotations.Test;) into the @Test.
- Run The java Program Test with Test NG.
- Find the all test result with summary.
Show the summary report:
- Refresh the java project. And test output folder is visible at the bottom of the project Explorer.
- Open the index.html file from test output folder
No comments:
Post a Comment