TestNG has a Data Provider feature that allows users to extract test data in any format. It returns an array of objects, which can be cast to a POJO (Plain Old Java Object; that is, no set of rules to follow) such as a JSONObject type. When creating the class with the method for extracting the data, users tag the method using the @DataProvider annotation.
The DataProvider method could be stored in the same class as the Test, but it makes more sense to create a generic static method in a separate class so all test classes can use the same DataProvider and format. Having a consistent format to encapsulate data will make it easier for users to maintain and enhance the framework and tests.
Finally, when storing the method in a separate class, the DataProvider method name and class must be passed to the @Test annotation as an attribute. We will explore...