I am not sure how to pass username ,password values to my test method from my data provider. My @DataProvider looks something similar to this,


public Object [][] getData()


Object[][] data = new Object[1][2];

Hashtable<String, String> credential1 = new Hashtable<String, String>();

credential1.put("username", "admin");

credential1.put("password", "admin");

Hashtable<String, String> credential2 = new Hashtable<String, String>();

credential2.put("username", "admin");

credential2.put("password", "WCM2k8Ap");

data[0][0] = credential1;

data[0][1] = credential2;

return data;




Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.

1 Answer

answered by
selected by
0 votes
Best answer

You can receive it like below.

public void myTest(Hashtable<String,String> credential1,Hashtable<String,String> credential2){
String username1 = credential1.get("username");
String username2 = credential2.get("username");