Forum Discussion
Dmitry_Nikolaev
Staff
15 years agoHi Carsten,
Yes, it is. You can do it in the following way:
1. Create one project temporary variable (type: Integer) - TestRunCount. Set its default value to 0. See the 'Project and Project Suite Editor - Variables Page' help topic for more information.
2. Add the following code into a script unit:
function getTestItemsCount(testItem)
{
if (null == testItem) {
testItem = Project.TestItems;
}
else {
if (false == testItem.Enabled) {
return 0;
}
}
var count = 0;
for (var i = 0; i < testItem.ItemCount; i++) {
count += getTestItemsCount(testItem.TestItem(i));
}
if (IsSupported(testItem, "Count")) {
count = (count + 1) * testItem.Count;
}
return count;
}
3. Create an event handler (it should reside in the same unit where getTestItemsCount does) for the OnStartTest event as follows:
function GeneralEvents_OnStartTest(Sender)
{
if(0 == Project.Variables.TestRunCount) {
count = getTestItemsCount();
}
Project.Variables.TestRunCount++;
Indicator.PushText(Project.TestItems.Current.Name + ", progress: " + Project.Variables.TestRunCount + " of " + count);
}
See the 'Creating Event Handlers in TestComplete' help topic for more information. Information about the Indicator object is available here.