title: Hashmap in testNG dataprivider to reduce arguments passing to test method
body: <p>I've been writing Test scripts using TestNG's DataProvider feature. Till now I was happy with the way I was doing it as the number of parameters I was passing was less than 10, but some of the new pages I am testing have more than 30-35 parameters, adding these parameters to the Test Method makes it look really ugly </p>
  
  <p>Its a good way of dynamically passing parameters, but then using them is difficult as you have to be really careful with the indexes and prone to errors if this has to be done for a lot of methods.</p>
  
  <p>I tried passing the test data as a ArrayList>, where the HashMap is the Column Name-Value pair but TestNG wont accept this as HashMap cant be cast as Object[]. The reason I thought of using HashMap is because you can query a key and get its value and the key is known to me. I could have written a common method to get the value and assign it to the variable representing the names of the fields on the page.</p>
  
  <p>The Data Source (XLS) only stores the test data that is entered on the page, so its purely data-driven and not keyword based. All the pages I am testing are data entry pages.</p>
  
  <p>What is the best way to have some kind of identity on the test data and also get TestNG to accept it.</p>
  
  <p>As an alternative I created a map while taking data from Excel and passing to data provider at the same time I created a hashmap and stored it globally to access in my test method but this way won't remove passing arguments to my test method</p>
  
  <p>Any help in this regards is really appreciated.
  Thanks 
  Ketan</p>