Forum Discussion

Urmikhan's avatar
Urmikhan
Occasional Contributor
5 years ago
Solved

Data Driven Testing using Excel file and import in to my script multiple times

Using DDT Driver for test data excel sheet to my script but it is not working .Could you give me the syntax how I iterate multiple test data in to my scripts:

I am using this syntax:

function Test() {
var xlValue = Project.Variables.TestData;
// Initialize the iterator
xlValue.Reset();
// Iterate through rows
while (!xlValue.IsEOF()) {
var input = xlValue.Value("Customer Name");

Log.Message(input);
xlValue.Next();

}
return input;

}

But how I include in to my test and multiple customer name is running.



  • This is all you need to reiterate through all the records in the excel worksheet:

    function Test()
    {
      DDT.ExcelDriver("File path and name", "Sheet name");
      While (!DDT.CurrentDriver.EOF())
      {
        Log.Message(DDT.CurrentDriver.Value("CustomerName"));
        DDT.CurrentDriver.Next();
      }
    }

    Thanks

    -Lino

1 Reply

  • LinoTadros's avatar
    LinoTadros
    Community Hero

    This is all you need to reiterate through all the records in the excel worksheet:

    function Test()
    {
      DDT.ExcelDriver("File path and name", "Sheet name");
      While (!DDT.CurrentDriver.EOF())
      {
        Log.Message(DDT.CurrentDriver.Value("CustomerName"));
        DDT.CurrentDriver.Next();
      }
    }

    Thanks

    -Lino