Hello Ahmed,
We are trying to automate error handling test case. Here is the scenario -
1. Excel sheet has 10 rows containing data.
2. From the first 9 rows, the data should be filled onto the form and 'Submit' button is to be clicked.
3. From the 10th row data, the data should be filled onto the form and 'Cancel' button is to be clicked.
Using Column count check, we were not getting the desired result.
We need to use the row count for this.
This is what we did.
function test_driver()
{
var....
// This will give the used row count
var excel = Sys.OleObject("Excel.Application");
var book = excel.Workbooks.Open("C:\\Excel.xls");
var rowCount = book.Sheets(1).UsedRange.Rows.Count;
Log.Message(rowCount);
excel.Quit();
Driver = DDT.ExcelDriver("C:\\Excel.xls", "Sheet1", true);
// Iterates through records
RecNo = 0;
i = 1;
while (! Driver.EOF() )
{
User_Registration(); // Run User Registration function
if (i<rowCount-1)
{
Submit_Button();
}
else
{
Cancel_Button();
}
i=i+1;
Driver.Next() // Goes to the next record
}
Aliases.iexplore1.IEFrame.Close();
// Closing the driver
DDT.CloseDriver(Driver.Name);
}
function User_Registration()
{
.
.
.
function to fill in data from excel sheet
.
.
}
There is nothing wrong in Test Complete tool, but we highly recommend that Test Complete should introduce inbuilt excel row count method.
If there is any better way to do this please let me know
Thank you.
Payal