Forum Discussion
makh_dv
14 years agoOccasional Contributor
Ernst,
Can you describe what you are trying to do?
TestComplete is able to work only with original XML nameMapping, "tcnm" format.
And xslt just provides a representation in different format, this is just an example to initial tread. And can be used by other tools.
If you are trying to make your own Object Mapping approach using custom xml, so probably I've directed you in wrong way.
Because I used that xml with other tool, non TestComplete.
The easiest way to have "custom NameMapping" is using object wrappers in a kind of PageObject pattern.
On the simple example of Notepad can look like following:
and if you want to store "Sys.Process("notepad").Window("Notepad", "*", 1).Window("Edit", "", 1);" this info in xml, you are probably free to select the format, I haven't seen good and flexible solutions for this, because all of this is wrapped by NameMapping/Alias functionality.
Imho NameMapping is really good here. and you can replace this hard to read getter return to "return Alias.Notepad.Edit";
P.S. please, someone suggest me, how can I wrap code examples in more tidy view in this forum :-)
Can you describe what you are trying to do?
TestComplete is able to work only with original XML nameMapping, "tcnm" format.
And xslt just provides a representation in different format, this is just an example to initial tread. And can be used by other tools.
If you are trying to make your own Object Mapping approach using custom xml, so probably I've directed you in wrong way.
Because I used that xml with other tool, non TestComplete.
The easiest way to have "custom NameMapping" is using object wrappers in a kind of PageObject pattern.
On the simple example of Notepad can look like following:
function NotepadWrapper()
{
this.getEditBox = function()
{
return Sys.Process("notepad").Window("Notepad", "*", 1).Window("Edit", "", 1);
}
this.sendEditKeys = function(keys)
{
this.getEditBox().Keys(keys);
return this;
}
this.setEditValue = function(value)
{
this.getEditBox().wText = value;
return this;
}
this.verifyEdit = function(expectedValue)
{
aqObject.CompareProperty(this.getEditBox().wText, cmpEqual, expectedValue, false);
return this;
}
}
//usage
function dummyTest()
{
var notepad = new NotepadWrapper();
notepad
.setEditValue("bla-bla Test")
.verifyEdit("bla-bla Test")
.sendEditKeys("begin from ")
.verifyEdit("begin from bla-bla Test");
}
and if you want to store "Sys.Process("notepad").Window("Notepad", "*", 1).Window("Edit", "", 1);" this info in xml, you are probably free to select the format, I haven't seen good and flexible solutions for this, because all of this is wrapped by NameMapping/Alias functionality.
Imho NameMapping is really good here. and you can replace this hard to read getter return to "return Alias.Notepad.Edit";
P.S. please, someone suggest me, how can I wrap code examples in more tidy view in this forum :-)