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 project variables. Whereas if TestExecute was used to run the tests then I want certain different values to be stored in the project variables. These values are used to manipulate other tests along the way.
I use TestExecute to run on my test machines and TestComplete on my host mostly for writing new tests.
Regards,
Daniel
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.
Another way:
var testrunner = Sys.FindId(Win32API.GetCurrentProcessId()).ProcessName; // "TestComplete" or "TestExecute"