简体   繁体   English

UFT中对象属性的参数化?

[英]Parameterization of object's properties in UFT?

I need to dynamically handle the object properties through code in my project as many of the object values are changing dynamically. 我需要通过项目中的代码动态处理对象属性,因为许多对象值都在动态变化。 So is there any way to parameterize object's properties in UFT? 那么有没有办法在UFT中参数化对象的属性

To parameterize Object's Properties you need to Open your Object Repository in Object Repository Manager and go to Tools > Manage Repository Parameters and here you will get a window named as Manage Repository Parameters . 要参数化对象的属性,您需要在对象存储库管理器中打开对象存储库,然后转到工具>管理存储库参数 ,在这里您将获得一个名为管理存储库参数的窗口。 In this window click on "+" button and add Name, Default Value and Description of the parameter. 在此窗口中单击“+”按钮,然后添加参数的名称,默认值描述 Till here you have successfully added the Dynamic Parameter. 到此为止,您已成功添加动态参数。

Now to assign this parameter to an object what you need to do is just click on your object in which you want to use this property and then configure the value of required description property by pressing Ctrl + F11 . 现在,要将此参数分配给对象,只需单击要在其中使用此属性的对象,然后按Ctrl + F11配置所需描述属性的值。 Now from Repository Parameter window you can select "Parameter" radio box and select the property you added before and click OK. 现在,从Repository Parameter窗口中,您可以选择“Parameter”单选框并选择之前添加的属性,然后单击OK。

After doing all these steps use this object in your code by just writing the below code and you are good to go with Parameterization of your Object. 完成所有这些步骤之后,只需编写下面的代码就可以在代码中使用此对象,您最好使用对象的参数化。

Repository.Value("AddedObject") = "ValueYouWantToPassInRequiredProperty"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM