cancel
Showing results for 
Search instead for 
Did you mean: 

What are the TestComplete variables?

SOLVED
Occasional Contributor

What are the TestComplete variables?

Hi everyone!

 

Let's say we have this: 

 

Sys.Desktop.KeyDown(0x0D)

 

What would "Desktop" be in this case? What if I want to run it such as:

 

variable = 'Desktop'
Sys.variable.KeyDown(0x0D)

 

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.

 

Thoughts?

 

2 REPLIES
Highlighted
Community Hero

Re: What are the TestComplete variables?

Hi,

 

> 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)';

evaluate(cmd);

 

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members 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. Postings made by [Community Expert Group] members
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.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================
Community Hero

Re: What are the TestComplete variables?

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.


Robert Martin
[Community Expert Group]
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.


I’ll be talking about “Hidden Treasures – TestComplete Script Extensions” at #SBConnect in October! Who’s joining me? Click here for tickets
Extensions available
Watch a new Video
Top Kudoed Authors