How will you test data-driven test using TestNG?

How will you test data-driven test using TestNG?

There are two ways to give arguments to our Test Methods directly in TestNG. Data Providers or an xml File can be used to pass parameters. Data Providers with a DataProvider Annotation, dataProvider Attribute, and dataProviderClass Attribute are the topic of this section. Here are a few screenshots of each Data Provider as seen through TestNG’s annotations package: