How to use Name Mapping in TestComplete UI objects for desktop applications?
-
Read [this](https://support.smartbear.com/viewarticle/80764/#Adding) and add more info on the question. – BVengerov Oct 05 '16 at 13:43
2 Answers
I don't use Namemapping because I have a similar problem to you, where the form names in the desktop application I test change constantly. What I did was create a separate script called 'Helper Funcs'. In that, I have two functions:
function findControl(module, propertyName, propertyValue) : Object;
var
m_process : Variant;
begin
m_process := Sys.Process(module);
Result := m_process.Find(propertyName, propertyValue, 1000);
end;
function findChildControl(parent : Object, propertyName, propertyValue) : Object;
var
m_result : variant;
begin
Result := parent.FindChild(propertyName, propertyValue, 1000);
end;
To use:
uses HelperFuncs;
procedure Test1;
var
frmActionForm_1 : variant;
edNewComplex : variant;
begin
frmActionForm_1 := findControl('Payroll', 'Caption', 'Company Address Details - Edit');
Delay(4000);
edNewComplex := findChildControl(frmActionForm_1, 'ObjectIdetifier', 'edNewComplex');
Delay(4000);
edNewComplex.Click(76, 11);
end;
In the above example, frmActionForm_1 is a form, edNewComplex is a control on the form. When funning the test, I search for the caption of the form, which is 'Company Address Details - Edit'.
Once the form is found, I search the child components of the form using findChildControl.
For the child components, I just use the name of the object. That I get by either using their Object Finding tool or I record a test and convert to script. It will usually have all the names of the objects you interacted with in the recording.
Good Luck.
Seth

- 575
- 7
- 20