2

I tried returning a single dimensional Object[] from dataProvider and it worked for me. But the same code is not working in my office environment.What would be the issue?

I am using TestNG 6.13.1

@DataProvider(name = "Data")
public Object[] dataProvider() throws BiffException, IOException {

    jxl.setExcel("UserDetails", "H:\\Data.xls");
    int rowcount = jxl.getRowCount();
    Object[] data = new Object[rowcount];

    data = jxl.getColumn("Row");//Returns String array

    return data;

}

@Test(dataProvider = "Data")
public void verify(String s) {
    System.out.println(s);
}
Alexey R.
  • 8,057
  • 2
  • 11
  • 27
  • What is the error that you are getting now? – Pradeep hebbar Jan 18 '18 at 16:44
  • TestNG has always mandated that a `@DataProvider` annotated method would return a 2D Object array or an `Iterator` (in the case of lazy data driven tests where the data source is too huge to be loaded in one shot or when the data source is a streaming data source). So not sure how it worked for you. – Krishnan Mahadevan Jan 19 '18 at 02:09
  • The same code worked on another system. But it isnt wokring on my company's system. It throws the following error. DataProvider must return either Object[][] or Iterator[], not class [[Ljava.lang.Object t – Varun Joshi Jan 19 '18 at 16:35
  • Can you please try at your end ? Just pass a String array instead of the JXL – Varun Joshi Jan 19 '18 at 16:36

0 Answers0