Ask a Question

How to validate a Windows Service is running through Test Complete

Occasional Visitor

How to validate a Windows Service is running through Test Complete

Hi there,


I'm new to Test Complete and scripting as a whole. I'm trying to build a test in Test Complete that can check the status of a Windows service and then display that status in the test log as well as allow me to fail the test if the status of that service is not "Running".


I've spent quite a few hours trying to find the answers I need with no luck. I only seem to be able to find really complex scripts that seem to have a lot of unnecessary logic and are far more advanced or they just don't seem to work at all. I've built and tweaked most of my existing tests using the record and playback functionality but I'm pretty sure this is too advanced for that. My project is built in JavaScript but I've been using the Test Complete script editor to try and get things working.


This PowerShell command returns the information I'm needing if I were running this test manually:

Get-Service WinRM

Example Results:

Status   Name               DisplayName
------   ----               -----------
Running  WinRM              Windows Remote Management (WS-Manag...

Does anyone have any ideas on how to approach this?


As much explaination as you can provide is much appreciated. It helps me to learn more about the "why" of things rather than just copying someone else's responses


Thanks for everyone's help in advance.



Esteemed Contributor

Have you looked into the WMI object built in to TestComplete?


Specifically, the GetServiceState and WaitForServiceState methods?


Those documents give very simple examples of scripts to execute that you can use to get started.

Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
SmartBear Alumni (Retired)

Thanks for your reply, Robert.


@bgarrick, did the provided links help you find the answer to your question?

Tanya Yatskovskaya
SmartBear Community and Education Manager

Showing results for 
Search instead for 
Did you mean: