Forum Discussion
AlexanderM
14 years agoStaff
Hi Steve,
Thanks for the correction. You are right, with one correction from my side though: your approach is applicable to those Test Items that are linked to script routines only.
This is not always the case in TestComplete.
Anyway, below, is a sample script implementing the suggested idea. The sample script iterates through all Test Items and runs those that are enabled and linked to a script routine:
function Test()
{
var curTestItem = new Array(Project.TestItems.ItemCount - 1);
var counter = 0;
Log.Message("Executing the enabled test items");
for (i = 0; i < Project.TestItems.ItemCount; i++)
if (Project.TestItems.TestItem(i).Enabled) {
curTestItem[counter] = Project.TestItems.TestItem(i);
counter++;
}
for (i = 0; i < counter; i++)
Log.Message(curTestItem.ElementToBeRun.Caption);
for (i = 0; i < counter; i++)
runTestItemRoutine(curTestItem);
}
function runTestItemRoutine(testItemObject)
{
var caption = testItemObject.ElementToBeRun.Caption.split("\\");
if (caption[0] == "Script") {
var script = caption[1].split(" - ");
Runner.CallMethod(script[0] + "." + script[1]);
}
}
Related Content
- 10 months agolodecesa
- 9 months agoMehwishDaud
- 2 years agorodm0001
Recent Discussions
- 14 hours agoMW_Didata