Forum Discussion
tonydugay
11 years agoContributor
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
11 years agoSuper 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
- TanyaYatskovska11 years ago
Alumni
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:
- 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/