In the previous tutorial we learned different types of TestNG annotations available. Now we are going to see how to implement the TestNG in use.
How to create First TestNG Script in Eclipse?
Prerequistie :
1.Need to install Java in system.
2.Install Eclipse and TestNG.
Lets get started with how to create an TestNG Script in Eclipse.
1.Create a package(SampleTestNG) in your project under SRC folder.
2.Under the newly created package, create a new class (SampleTest).
3.Write @Test After the class name.
4.Create a method in java
1 2 3 4 5 6 7 8 |
Public class SampleTestNG { @Test public void SampleTest() { System.out.println(“This is a Testng Example”); } } |
5.To Execute the Test script in TestNG. Right click on the script(i.e SampleTestNG.java) and click RunAsàTestNG Test.