Issue with the Data driven testing | Selenium Forum
M
Posted on 05/04/2016
Hi,

I have three test cases, one to create a new request, the second one to review the request created using testcase#1 and the third one to approve the request. These test cases are executed sequentially. All three of them are data driven using the Xls_Reader. The first test case has three rows of data i.e., we are creating three requests, the second(reviewer) and third test cases(approver) each have only one row of data. The problem I am having is selenium creates three new requests but only one request is reviewed and approved. I want all the three requests to be reviewed and approved. Any idea how to resolve this?

M
Replied on 06/04/2016

try "depends on" statement on your test cases.


M
Replied on 06/04/2016

It did not work. Here are my two test cases and the data which is used by the two test cases. The first test case is running for the two rows of data and the second test case is only run for the first row of data. All I need is once the first test case creates a new request with one row of data, I want the second test case to be kicked off and once it is finished, I want the first test case to create a new request using the second row of data . Please advise?

[b:18rmd8ot]Test Case #1:[/b:18rmd8ot]

@Test(dataProvider="getTestData")
public void reqForm(String User, String projName, String projStartDate, String portfolio, String reqType,
String fiscalyear, String projEndDate, String sponsor)
{
Reporter.log("ABC - ABC Request Form Testcase");
// test the runmode of current dataset
count++;
if(!runmodes[count].equalsIgnoreCase("Y")){
skip=true;
throw new SkipException("Runmode for test set data set to NO "+count);
}


ABCRequestForm e = new ABCRequestForm();
e.requestForm( User, projName, projStartDate, portfolio, reqType, fiscalyear, projEndDate, sponsor);

}

[b:18rmd8ot]Here is the data from the excel spreadsheet:[/b:18rmd8ot]

User projName projStartDate portfolio reqType fiscalyear projEndDate sponsor Runmode
John Selenium1 6/1/2016 Treasury Dept New Investment 2016 7/1/2016 Ajay Y
Abby Selenium2 7/1/2016 Revenue Dept New Investment 2016 8/1/2016 Ajay Y



[b:18rmd8ot]Test Case # 2[/b:18rmd8ot]

public void BizSponsorApproval(String sponsor)
{

Reporter.log("EBC Business Sponsor Approval Testcase");
// test the runmode of current dataset
count++;
if(!runmodes[count].equalsIgnoreCase("Y")){
skip=true;
throw new SkipException("Runmode for test set data set to no "+count);
}



EBCSponsorApproval s = new EBCSponsorApproval();
s.approvalForm(sponsor);

}

[b:18rmd8ot]Test Data for test case #2[/b:18rmd8ot]

sponsor Runmode Results
Ajay Y PASS


M
Replied on 07/04/2016

send me your project