Thursday, June 20, 2013

Ant task to run all tests by the specified group name

Following ant task shows us how to run all testng tests those are specified with the group "alltests" in the test classes. We can actually do this by two ways. 

Type-I(from testng suite) 
The following target runs all the tests with group "alltests". In this case it will search for all the tests that are specified with group "alltests" and only for the tests/classes/packages specified in the testng.xml(test suite) only. After executing the tests it creates the testng report in the "reprots.testng" directory specified in ant property.
 

 
 
  
   
  
 
Type-II(directly from the classes) 
The following target runs all the tests with group "alltests". In this case it will search for all the tests that compiled and there in the "classes" directory specified in the ant property. After executing the tests it creates the testng report in the "reprots.testng" directory specified in ant property.
 

 
 
  
   
   
   
  
 
The report generated by testng looks like the below snapshot:


No comments:

Post a Comment