@Test Method at Class Level
The @Test annotation can be put on a class instead of a test method, it is very useful when user want to run all public methods in that class even though user not defined any annotation
Lets create a java class
package testngexp;
import org.testng.annotations.Test;
@Test
publicclass classlevelexamples {
publicvoid TestLoginMethod(){
System.out.println("this is Login Method");
}
publicvoid TestLogoutMethod(){
System.out.println("this is Logout Method");
}
}
TestNG.xml
<?xmlversion="1.0"encoding="UTF-8"?>
<!DOCTYPEsuiteSYSTEM"http://testng.org/testng-1.0.dtd">
<suitename="Suite"verbose="1">
<testname="Test1">
<classes>
<classname="testngexp.classlevelexamples"/>
</classes>
</test><!-- Test -->
</suite><!—Suite -->
Results
Comments
Post a Comment