public void UserConsentCreate(String TestNumber,String email,String lastName,String firstName,String deviceCode, String appVersion,String phone,String countryCode,String loginPassword,String dob,String baseUrl, String contactViaEmail, String contactViaSMS,String address1, String address2, String city, String postcode, String ukResidentConfirmation, String notificationConsent, String locationConsent
,String hasMedicalCondition, String hasAwaitingDiagnosis) throws IOException {
int version = MaintreeVersion(TestNumber);
System.out.println(version);
JSONObject body =new JSONObject();
body.put("personReference",dataReader.PERSONREFERENCE_PROPERTY_READER(TestNumber));
body.put("contactViaEmail",contactViaEmail);
body.put("contactViaSMS",contactViaSMS);
body.put("mainTreeVersion",version);
JSONObject auidtbody =new JSONObject();
auidtbody.put("localTime", dtf.format(now));
auidtbody.put("GMTTime", dtf.format(now));
auidtbody.put("appRequestedTime", dtf.format(now));
auidtbody.put("agentId", "1");
auidtbody.put("agentName", "App");
auidtbody.put("channel", "APP");
auidtbody.put("deviceCode","1234567890");
body.put("audit",auidtbody);
}
I used a CSV file to get data data provider code
@DataProvider(name = "customer" )
public static Object[][] getUserData() throws IOException, CsvValidationException {
**String xlFilePath = System.getProperty("user.dir") + "/src/TestData/User.csv";
String[] line;
List<String[]> arrlist = new ArrayList<String[]>();
CSVReader reader = new CSVReader(new FileReader(xlFilePath));
while ((line = reader.readNext()) != null) {
arrlist.add(line);
}
int index = 0;
arrlist.remove(index);
int rowCount = arrlist.size();
int columnCount = arrlist.get(0).length;
String customerData[][] = new String [rowCount][columnCount];
for(int i = 0 ; i < rowCount ; i++) {
String[] eachRow = arrlist.get(i);
for(int j = 0 ; j < columnCount ; j++) {
customerData[i][j] = eachRow[j];
}
}
return customerData;
}
Is there any other way to declare the parameters for the test method? One parameter change I want to change every method.How to slove this problem. I try to String args[] way it is working. i want to know is there any other solution?