How can we pass less parameters than the method require us to do using DataProvider?
I will try to explain, let say for an example i created a Method called fetchData(string objectype,string object value, String locatortype,String locatorValue,String message);
I am retrieving the data from the Excel file, on its first line i am passing only two parameters not all five of them using DataProvider annotation, only on the fourth line i am passing all the parameters as the Method demands.I didn't encounter any error,it works perfectly fine.
my understanding is this, you cannot pass less parameters than the method requires you to do,apparently it possible using DataProvider annotation,but how?
className.perform(row.getCell(1), row.getCell(2),row.getCell(3), row.getCell(4));
There is no data in the 2 and the 3 columns of the first row in the ExcelFile
perform(GOTOURl,'','',URL)
public static void perform(String operation, String objectName, String objectType, String val)
{
System.out.println("");
switch (operation.toUpperCase())
{
case "CLICK":
driver.findElement(this.getObject(p, objectName, objectType)).click();
break;
case "SETTEXT":
driver.findElement(this.getObject(p, objectName, objectType)).sendKeys(val);
break;
case "GOTOURL":
driver.get(p.getProperty(val));
break;
case "GETTEXT":
driver.findElement(this.getObject(p, objectName, objectType)).getText();
break;
default:
break;
}
}
You are still passing all 4 parameters, it's just that objectName
and objectType
are passed as empty string.