ahmed_daniel
9 years agoOccasional Contributor
Solved
Is there a way to find out how a test was started by TestComplete or TestExecute?
Hi, I want to know if there is way I could check if the automated test is started by TestComplete or TestExecute from script within tests? If TestCompelte starts I want certain values for projec...
- 9 years ago
You can try using BuiltIn.ParamStr(0) function to grab the command line executable. That function grabs the command line args like a Java or C-based program, so calling it at index 0 gives the executable string. You'd then have to play around with the string to see if it contains TestComplete.exe or TestExecute.exe. So for example if you launch with TestComplete the BuiltIn.ParamStr(0) will be the string 'C:\Program Files\SmartBear\TestComplete 11\Bin\TestComplete.exe' (or wherever your TestComplete executables is installed.
Here's one way you might do it in python:
command_str = BuiltIn.ParamStr(0) if command_str.find('TestComplete.exe') != -1: #Set values for TestComplete else: #Set values for TestExecute
Or whatever best method you think.
- 9 years ago
Another way:
var testrunner = Sys.FindId(Win32API.GetCurrentProcessId()).ProcessName; // "TestComplete" or "TestExecute"