TestNG is the next generation testing framework. You can easily integrate your selenium scripts in TestNG.
Please follow below steps to run TestNG tests in Eclipse.
Please follow below steps to run TestNG tests in Eclipse.
- Download TestNG at http://testng.org/doc/download.html
- Then Create a TestNG class in any project.
- Define test methods in that class using @Test annotation
- Right click on the TestNG class and run as TestNG class.
package framework; import org.testng.Assert; import org.testng.annotations.AfterSuite; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeSuite; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; public class NewTest { @Test public void Test1() {
//Test something here. Assert.assertNotNull("abc");
} @Test public void Test2() {
//Test something here.
Assert.assertNull("jj");
}
@BeforeSuite
public void beforeSuite(){
//this method is called once before test execution starts
//here you can write a code to launch the selenium web driver.
}
@AfterSuite
public void afterSuite(){
//this method is called once after test execution ends.
//here you can write a code to close and quit the selenium web driver.
}
}
What do you think on above selenium topic. Please provide your inputs and comments. You can write to me at reply2sagar@gmail.com
No comments:
Post a Comment