Executing all Test files of a Package through testng.xml

August 21, 2016

Let us consider a scenario where you want to execute all the test case of all the files in a package. This can easily be done via TestNG.xml file. In TestNG.xml we can include a package or packages.

Below is the sample of TestNG.xml file to run all the test cases of a package.

Here, in above testng.xml file a package with name com.qatechhub.testng.package1 is included. Let us consider this package consist of two different classes with name TestClass1 and TestClass2.

After executing testng.xml file all the test cases of these above-mentioned classes will be executed.

Code of TestClass1:

Code of TestClass2:

Result of above execution:


HTML Report of above code:


PS: For any questions queries or comment feel free to write us at saurabh@qatechhub.com or support@qatechhub.com. Happy Learning


About the Author


Follow Saurabh:

Leave a Comment: