Forum Discussion

anatar02's avatar
anatar02
Contributor
13 years ago

Is there any way to keep all the Objects in Xml instead of NameMapping

Hi All,



Is there any way to keep all the Objects into the xml and including that xml into each scripts instead of default NameMapping?, If yes! could you please guide me.

9 Replies

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3
    Hi Ashok,



    Actually, NameMapping file is an xml one.

    Or you can craft your own xml file with the structure you need and use it in your projects.
  • gentlesea's avatar
    gentlesea
    Frequent Contributor
    How do I apply the XSLT? Is there a program for doing this?
  • Hello all,



    Thanks for your valuable reply :)







    Alexei Karas-



    Could you please help me to create our own Object-repository in xml format. would great, if you provide some sample Object-repository  xml for me to understand.


  • gentlesea's avatar
    gentlesea
    Frequent Contributor
    I applied the XSLT using EditiX and the resulting file is about 1/10th of the size of the original. But it does not work anymore. Is there manual work necessary after the XSLT conversion?
  • makh_dv's avatar
    makh_dv
    Occasional 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:



    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 :-)
  • gentlesea's avatar
    gentlesea
    Frequent Contributor
    Dmytro, I thought your script would shrink the NameMapping. I just tried it out of curiosity. I am fine like this also. No worries. To wrap code, use












  • AlexKaras's avatar
    AlexKaras
    Champion Level 3
    Hi Ernst,



    > I thought your script would shrink the NameMapping.

    You may check the Name Mapping | Store Code Completion information property for your project (available via right click on the project node, then Edit | Properties) and set it to None.