cancel
Showing results for 
Search instead for 
Did you mean: 

Run a unit method to get the properties of Objects defined in that Unit

SAHMED
Occasional Contributor

Run a unit method to get the properties of Objects defined in that Unit

I have some wrapper function/Method for Name Mapping objects,  like 

------------

unit1

 

Public mainwindow, textField,pasField

 

Sub init_Objects 

Set mainwindow = Aliases.App.Window

Set textField = mainwindow.textUsernameField

Set pasField = mainwindow.textUserPasswordField

 

 

End Sub

----------------------------------------------------------------------------------

 

I'm not able to get all the properties and methods when I write scripts in code completion. 

e.g. 

 

Unit1.mainwindow.___     ''' ----------- Properties and methods are not shown in the code completion.

OR

Call Unit1.mainwindow.___     ''' ----------- Properties and methods are not shown in the code completion.

 

 

I think issue is that assignments will be made at run time (test execution). So how can I get the properties of object at design time (writing script).

 

- I've tried to create Script Extension but not able to get this functionality. my script ext. code is like:

 

Sub  InitObject

 

Runner.CallMethod ("unit1.init_Objects ")

 

End Sub

 

In description.xml I 've mentioned it under runTimeObject node

<Script Name = "xyz.vbs" InitRoutine="Initialize">
<RuntimeObject Name = "xyz">
<Method Name="InitObject" Routine="InitObject">
</Method>
</RuntimeObject>

 

I'm new to Script extensions so kindly guide if I'm doing something wrong and how can this issue be resolved.

 

Thanks,

 

4 REPLIES 4
tristaanogre
Community Hero

Re: Run a unit method to get the properties of Objects defined in that Unit

Code Completion needs to know, when you enter in the unit and the routine name, where to get the information from.  In whatever unit you are calling Unit1.mainwindow you need to include a 'USEUNIT call.

'USEUNIT Unit1

Unit1.mainwindow....

If you do this, Code completion should work.

As for creating a runtime object, what you've done is correct for the method. But what it seems you want is to be able to access properties.  For this, you need to create properties on your runtime object.  

I'd suggest you take a look at the tutorial https://support.smartbear.com/viewarticle/74328/ for creating runtime objects. It walks you through, in detail, how to do exactly what you want.


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
SAHMED
Occasional Contributor

Re: Run a unit method to get the properties of Objects defined in that Unit

Hi,

 

Thank you Tristaanogre.

 

For the second option i.e. defining properties for Runtime Object it could be done But I'm not intrested in doing this way because I have to define alot of properties and maintenace of Objects and properties is difficult.

 

I'm intrested in doing it method for First option from your reply, I'm currently using my objectwrapper in this way but it is not working for me. See the attached snapshot and it will be great if it could be done.

 

Thanks,

TanyaYatskovska
Community Manager

Re: Run a unit method to get the properties of Objects defined in that Unit

 

Hi Sahmed,

 

 

I'm not sure if it's even possible. I recommend that you contact our TestComplete Support Team to investigate this behavior. You can reach out to them here: http://support.smartbear.com/product-list/

---------
Tanya Yatskovskaya
SmartBear Community and Education Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
SAHMED
Occasional Contributor

Re: Run a unit method to get the properties of Objects defined in that Unit

Thank you for the Update Tanya.

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors