What are the TestComplete variables?
Let's say we have this:
What would "Desktop" be in this case? What if I want to run it such as:
variable = 'Desktop'
When I tried to get the type through Python, it returned Null (literally an empty space). The reason is I add a new build of a software - and it gets named "TestApp_2_4_20_0" and I want to use
variable = "TestApp_2_4_20_0"
To change quickly.
If that isn't possible, is it possible to rename a program added midscript?
installer = TestedApps.Add('path\\TestApp_2_4_20_0.exe') test = TestedApps.Items[installer] test.Run()
Then the tested app is still named 'TestApp_2_4_20_0', when it would make my life easier if I could rename it.
Solved! Go to Solution.
> What would "Desktop" be in this case?
Desktop in this case is an object provided by TestComplete. See documentation for more details on it.
> To change quickly.
i don't know exact syntax for Python, but all scripting languages have eval()/evaluate() function (or a kind) that accepts a string that must conform to the given script language requirements, evaluates it as a code and returns a result.
So, say, for JScript the code will be like this:
var variable = 'Desktop';
var cmd = 'Sys.' + variable + '.KeyDown(0x0D)';
/Alex [Community Champion]
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
You can do TestedApps.Add to add a new tested app. The code you have indicated should work.
But honestly, that seems a bit bulky. If you can run your application at a command line, you should be able to utilize the WshShell.Exec method to execute the command line to run your application without needing to add it to TestedApps.
[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