Yes could be because of the way you are reading from excel (greedy data provider) and depends on how big your excel file is. There is something called lazy data provider. Found an example of one here . Posting the code from the link.
For better understanding need to see your code.
public class LazyDataProviderExample {
@Test(dataProvider = "data-source")
public void myTestMethod(String info) {
Reporter.log("Data provided was :" + info, true);
}
@DataProvider(name = "data-source")
public Iterator<Object[]> dataOneByOne() {
return new MyData();
}
private static class MyData implements Iterator<Object[]> {
private String[] data = new String[] { "Java", "TestNG", "JUnit" };
private int index = 0;
@Override
public boolean hasNext() {
return (index <= (data.length - 1));
}
@Override
public Object[] next() {
return new Object[] { data[index++] };
}
@Override
public void remove() {
throw new UnsupportedOperationException("Removal of items is not supported");
}
}
}