Forum Discussion

shiva_ranabhat's avatar
shiva_ranabhat
Contributor
9 years ago
Solved

Use csv/excel file to update Project Suite/Project variables before running test?

Hi,   I was just wondering if there is a way to update project suite/project variables value using data-driven logic? It would help non-QA staff to just use file to update all variables and run th...
  • NisHera's avatar
    9 years ago

    You can do something like this...........

     

    DDT.ExcelDriver('C:\myVariable.xlsx','sheet1',true);
    do {
       if (!Project.Variables.VariableExists("DatabaseName"))
                { Project.Variables.AddVariable("DatabaseName", "String") }
        Project.Variables.DatabaseName = DDT.CurrentDriver.Value('DBname');
        }
    while (!(DDT.CurrentDriver.EOF()));
    DDT.CloseDriver(DDT.CurrentDriver.Name);

  • joseph_michaud's avatar
    joseph_michaud
    9 years ago

    As a convenience, you can access a variable in the Variables collection by its name.  "varName" is not the name of the variable in the collection.

     

    You probably want


    ProjectSuite.Variables.VariableByName(varName) = varValue;