July 2019
Intermediate to advanced
536 pages
12h 57m
English
TestNG has an annotation called @DataProvider that tags a method in a class as a DataProvider, which can then be called on the test methods. It can take an attribute name to be used when declaring it in the test method. The following example shows the annotation in use:
// Simple Data Seeded Data Provider Method@DataProvider(name = "myData_JSON")public static Object[][] fetchData() throws Exception { JSONObject object = new JSONObject(); object.put("name", "Kiss"); object.put("year", "1973"); object.put("song", "Rock and Roll All Nite"); return new Object[][] {{object}};}
/** * TestNG DataProvider Class for extracting JSON data * * @author Name * */public class JSONDataProvider { public static String dataFile ...
Read now
Unlock full access