Running the Execution Plan enabled items via script within TestComplete

Originally posted by ilkoTest on August 25, 2026

Hi,

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.

Thanks

Originally posted by rraghvani on August 26, 2026

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

Originally posted by eykxas on August 26, 2026

Hi !

How do you initialize “itemSelected” ? I think the problem is here. I’m pretty sure “ItemSelected” does not expose a Run() function.

Originally posted by ilkoTest on August 26, 2026

This is JavaScript code. The initialization is done by assigning a value to the itemSelected:

for (var i = 0; i < count; i++)
  {
    var itemSelected = testItems.TestItem(i);

And you’re right; it does not expose the Run() function, which I am getting an error for.

Originally posted by ilkoTest on August 26, 2026

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

Originally posted by rraghvani on August 27, 2026

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.

Hope this will help…

Originally posted by ilkoTest on September 01, 2026

Thank you, AlexKaras​ for your suggestion. I will definitely try that out

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.

But it sounds like more trouble than its worth.

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.

Originally posted by ilkoTest on September 10, 2026

Thank you, Alex