Forum Discussion
ilija_panov
14 years agoContributor
I even tried with user and object variables of Object type and that doesn't work as well:-(.
For sure there must be something wrong with the recursive function
function Main()
{
var Driver;
Driver = DDT.ExcelDriver("c:\\logon.xlsx", "MKD", true);
RecNo = 0;
while (!Driver.EOF())
{
user = DDT.CurrentDriver.Value('user');
Log.Message(user);
password = DDT.CurrentDriver.Value('password');
Log.Message(password);
accounts = Database.getAccounts(user);
Log.Message(accounts);
recursiveTraverse(Project.TestItems);
Driver.Next();
}
DDT.CloseDriver(Driver.Name);
}
function recursiveTraverse(Level)
{
var Items = Level.ItemCount;
for(var i = 0; i <=(Items-1); i++)
{
runTestItemRoutine(Level.TestItem(i));
recursiveTraverse(Level.TestItem(i));
}
}
function runTestItemRoutine(TestItemLevel)
{
if (TestItemLevel.ElementToBeRun != null)
{
var caption = TestItemLevel.ElementToBeRun.Caption.split("\\");
if (caption[0] == "Script")
{
var script = caption[1].split(" - ");
if (script[1] != "Main")
{
Runner.CallMethod(script[0] + "." + script[1]);
}
}
}
}
Otherwise the project variables can be passed without any problem but when the same tests usign them are called in the recursive function they are becoming empty. Any help is appreciated.
Thanks in advance,
Ilija
For sure there must be something wrong with the recursive function
function Main()
{
var Driver;
Driver = DDT.ExcelDriver("c:\\logon.xlsx", "MKD", true);
RecNo = 0;
while (!Driver.EOF())
{
user = DDT.CurrentDriver.Value('user');
Log.Message(user);
password = DDT.CurrentDriver.Value('password');
Log.Message(password);
accounts = Database.getAccounts(user);
Log.Message(accounts);
recursiveTraverse(Project.TestItems);
Driver.Next();
}
DDT.CloseDriver(Driver.Name);
}
function recursiveTraverse(Level)
{
var Items = Level.ItemCount;
for(var i = 0; i <=(Items-1); i++)
{
runTestItemRoutine(Level.TestItem(i));
recursiveTraverse(Level.TestItem(i));
}
}
function runTestItemRoutine(TestItemLevel)
{
if (TestItemLevel.ElementToBeRun != null)
{
var caption = TestItemLevel.ElementToBeRun.Caption.split("\\");
if (caption[0] == "Script")
{
var script = caption[1].split(" - ");
if (script[1] != "Main")
{
Runner.CallMethod(script[0] + "." + script[1]);
}
}
}
}
Otherwise the project variables can be passed without any problem but when the same tests usign them are called in the recursive function they are becoming empty. Any help is appreciated.
Thanks in advance,
Ilija