TestNg provides an option to include or exclude Groups, Test Methods, Classes and Packages using include and exclude tags by defining in testng.xml.
First we will create an examples to use include and exclude tags for Test Methods in a class.
We will create a Class with three Test Methods. In that we will include two test methods and try to exclude one test method.
Below is the example class file with three test methods