Hi Everyone,
Since this is the only way I have found across the forums and documnetation on how to traverse a test suite consisting of scripts in JSScript, I would really appreaciate of you can tell me what I'm doing wrong in my main function translated in JScript from the one above posted in VBScript
function main()
{
var Driver;
Driver = DDT.ExcelDriver("C:\\logon.xlsx", "BOS", true);
RecNo = 0;
while (!Driver.EOF())
{
Project.Variables.user = DDT.CurrentDriver.Value("user");
Log.Message(Project.Variables.user);
Project.Variables.password = DDT.CurrentDriver.Value("password");
Log.Message(Project.Variables.password);
recursiveTraverse(Project.TestItems);
Driver.Next();
}
DDT.CloseDriver(DDT.CurrentDriver.Name);
}
function recursiveTraverse(Level)
{
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(" - ");
Runner.CallMethod(script[0] + "." + script[1]);
}
}
}
I susptect there are some syntax errors in the runTestItemRoutine function. Would very much appreciate if you can tell me what is wrong with the function in JScipt. It seems to go through all the records in the DDT driver, but it does not run any of the scripts in the Test Items page. I tried with them being unchecked as said above, or checking all of them but it doesnt make a difference . Thanks in advance and I'm looking forward to your answer.
Best Regards,
Ilija
P.S attached you can find a screenshot of the test items page