Actually, I want to read the invocation count value from an excel file
I have tried this way, the int value from the excel file reading successfully
int x = ReadExcelNumber.readData(excelPath, "0", rowNo, "2");
@Test(invocationCount = x)
but while using it, it’s showing error like
Attribute value must be constant
any kind of help appreciated, thanks
Aleksei
February 26, 2021, 10:07am
2
try:
private Object[][] data = new Object[0][0];
@DataProvider(name = "countProvider")
public Object[][] createData() {
// here some code to generate needed 5
data = new Object[5][1];
}
return data;
}
@Test(dataProvider = "countProvider")
Thanks @Aleksei for your answer, the value will be fixed, which I will read from the excel file, question updated
Aleksei
February 26, 2021, 11:42am
4
Aleksei:
data = new Object[5][1];
so just replace with:
data = new Object[ReadExcelNumber.readData(excelPath, "0", rowNo, "2")][1];
also similar → java - How to set invocationCount value at run time in TestNG @Test Annotation - Stack Overflow