I have a huge test project that contains hundreds of test items. Unfortunately, TestComplete does not provide a progress indicator for the test execution. The entire project runs for many hours, and it would be great to see how many test items were executed.
I am trying to write a JavaScript script that can execute the enabled test items in the Execution Plan one after another and show me the execution progress.
I am stuck at the point where I am trying to execute the following command block:
if (itemSelected.Enabled)
{
Log.Message("The selected item is enabled");
var progress = Math.round((i / count) * 100);
Log.Message("The progress value is: " + progress);
Indicator.PushText("Running: " + itemSelected.Name + " (" + progress + "% Complete)" + "out of " + count);
try {
itemSelected.Run();
}
catch(e){
Log.Error("Error executing " + itemSelected.Name + ": " + e.message);
}
Indicator.PopText();
}
else
{
Log.Message("The current item is disabled in the Execution Plan");
}
TestComplete throws the error saying that
Error executing : itemSelected.Run is not a function
If I remove the brackets after Run, TestComplete ignores this command and iterates to the next item.
I was wondering if anybody has any idea how to overcome this and run the selected test items via script.
I don’t think it can be done within TestComplete. However, you can you either use Batch file or PowerShell script file to do this, via TestComplete Command Line
Thank you for your reply. While the TestComplete Command Line seems a good solution for running the tests, I don’t think it will support the progress indicator, which is my primary focus of why am I doing all of this
PowerShell can display a progress bar via Write-Progress.
For unattended automation, I would recommend a combination of progress/status + logging + failure notification. A progress bar alone isn’t sufficient because it can’t tell you whether a job has silently failed.
Originally posted by AlexKaras on September 01, 2026
Hi,
TestItem object does not expose .Run() method. That is why you are getting the error.
Somewhere in time when I’ve implemented similar functionality, I parsed ElementToBeRun property to get names for corresponding script unit and function to be called and executed corresponding code via Runner.CallMethod() call.
Originally posted by MW_Didata on September 10, 2026
The Executionplan is saved in your {ProjectName}.mds file.
its in xml so you could have Testcomplete count all items and calculate that to a percentage.
Then with Indicator.PushText() you can display it on your screen.
Originally posted by ilkoTest on September 10, 2026
Thank you for your suggestion.
I believe this solution will create a lot of trouble by dynamically opening and reading the .mds file, which is used by the same project. I’d rather manually monitor the progress by comparing the test name with a table of all test cases.
Originally posted by AlexKaras on September 10, 2026
Hi,
Actually, one can get a number of test items in the project plan via Project.TestItems.ItemCount property. Then one can iterate over project plan, count the number of enabled test items (see code example in the help topic for the Project.TestItems.ItemCount property), convert to percentage and visualize the result via Indicator object as it was suggested by MW_Didata.
The case here (if nothing changed during past several years since the time when I implemented something similar) was that groups in project plan look pretty much as test items and it is not that easy to distinguish group from actual test item. And this resulted in somewhat ‘strange and visually unclear’ behavior of the tests run progress displayed by the Indicator object.