How to Stop @DataProvider to execute all records in Excel | Selenium Forum
M
Posted on 22/12/2016
Hi,
I am working on a In-house project, I am using a Excel Sheet in which there are Two records with two "[b:2wwg1w4o]Request Numbers[/b:2wwg1w4o]" with the help of @Data Provider annotation i am trying to fetch the record from excel.

int count = xl.getRowCount("TestData"); ===> Display total count in Excel sheet
for(int i =1;i<AHApprovaltable.size();i++){
if(ji==(count-2))
break;
AHApprovaltable = getElements("tableCompleteData_xpath");
String tableData = AHApprovaltable.get(i).getText().trim();

[color=#BF0000][b:2wwg1w4o][u:2wwg1w4o]for(int j=2; j<count;j++)[/u:2wwg1w4o][/b:2wwg1w4o]{ >>> [b][Because there are Two Records in Excel so DataProvider is run two time to execute these records. But my For loop "for(int j=2; j<count;j++)" my code will is execute two
time on first login and perform "Approved" for both RequestNumber. When loop is complete than my data provider is again run second time and try to execute the record but i don't want to do that if my both Request Number has been approved in one attempt than @DataProvider should not run second time. So please help me how to do that..]

Thanks.

M
Replied on 23/12/2016

data provider runs as many times as column number in excel.

I don't have the code for what you're asking but I think what you could do is [color=#FF0000:1lsifeia]make a function such as isTestRunnable but instead of checking the test runmode you could check approved column and if the test is already approved it would skip the test.[/color:1lsifeia]