Forum Discussion

Ravik's avatar
Ravik
Super Contributor
11 years ago

Can we set/update run time objects Properties of in NameMapping

HI All, 

 

Can we set/update run time objects Properties of in NameMapping.

 

In my Application some object properties are chinging at RunTime (Objects are already added in NameMapping). I Wanted to know can we set/update objects properties at RunTime in NameMapping. Which is we can use for further Testing.

 

(Is there any method like in QTP SetToProperty method is available)

 

 

Thanks

Ravik

3 Replies

  • I think what you might need to do is rather than have properties set to Constant values, use the Project Variable mode for the property in the NameMapping.

     

    When you set the Project Variable in your code, then call Aliases.RefreshMappingInfo() and TestComplete should now recognise the object.

    • Ravik's avatar
      Ravik
      Super Contributor
      Hi, Could you please give me a sample code for how to use project variable while adding object in name mapping file and how can we use it. Thanks Ravik
      • Hi,

        To add a project variable as a mapped property value, do the following:

        • Select an object in the Name Mapping editor. You will see its identification properties on the right.
        • Select a property, press F2 and then click the ellipsis button in the property value cell. The Edit Property Value dialog will appear:
        • ProjectVar
        • Select Mode = Project Variable and specify the variable you want to use to identify this object.

        In your test, use the following code to assign a project variable:

        Project.Variables.Var1 = "some value"

        If you use a keyword test, add the Set Variable Value operation - http://smartbear.com/viewarticle/56300/