Forum Discussion

mattcarp's avatar
mattcarp
New Contributor
14 years ago

Issues With Mapping in Web Apps

Hello and thank you for creating a Novice User section, as this is certainly a novice question.



I have the pleasure of testing a web-based application which dynamically creates a DOM tree with different object names each time a page loads.  Thus when playing back my Keyword Tests I always get an Object Not Found.  Here is an actual example for a TextNode ode that I'm trying to set a Property Checkpoint on:



Aliases.firefox.pagePromo.panelExtComp1576.panelExtGen107.panelExtGen108.panelExtComp1566.Panel("ext_gen286").Panel("ext_gen287").Panel("Campaigns").Panel("ext_gen306").Panel("ext_gen308").Panel("ext_comp_1054").Panel("ext_gen345").Panel("ext_gen346").Panel("ext_gen349").Panel("ext_comp_1046").Panel("ext_gen351").Panel("ext_gen352").Panel("ext_comp_1595").Table(0).Cell(0, 5).TextNode("ext_gen19")



That last TextNode has an innerHTML property of "Active Campaigns", which is what I want to verify in my Property Checkpoint.  I've tried re-parenting the item, and have mapped it so that it is identified by ObjectType=TextNode, innerHTML=Active Campaigns, and className=active-breadcrumb, all of which appear to be static across runs of the application.  I've set the "Extended Find" checkbox.  I still get "Object Not Found" when playing back the test.



Any advice on this would be greatly appreciated.  Thanks!



matt

4 Replies

  • Hello Matt,


    As far as I can see, your application contains Ext JS controls. These controls are quite dynamic, so their names change from time to time. You need to edit the mapping criteria of all such controls so TestComplete can find the objects during the playback. For example, if an object is mapped by the following properties:


    ObjectType: Panel

    idStr: ext-gen107

    ObjectIdentifier: ext_gen107


    you can modify its mapping criteria to make sure that TestComplete recognizes it as follows:


    ObjectType: Panel

    idStr: ext-gen*

    ObjectIdentifier: ext_gen*

    className: x-window-bl


    Please note that you need to map all controls that are referenced in your test as objects with hard-coded names like 'Panel("ext_gen306")', otherwise, the "Object not found" error is likely to occur during the playback.


    For more information, please see the Modifying Mapping Criteria article.

  • mattcarp's avatar
    mattcarp
    New Contributor
    Hi Allen.  You are absolutely right in that the application that I want to test is a web based ext-js setup.  As you advised, I've assigned wildcards (*) to the end of objects in the DOM which might change each time a page is rendered.  I did this up the DOM tree, such that each object which had a number assigned to it is now assigned a star.  Whenever getting a warning message that the identifcation of the object was ambiguous, I identified additional properties so that the warning didn't appear again.  Separately, I tried 're-parenting' the item by dragging it up to the parent level of its page, and I've also (separately) flagged the checkbox which allows the object to be found anywhere within the hierarchy.



    I continue to  receive "Object Not Found".  I'm cleary missing something.  I'm getting myself into an awkward position in that I promised my client that the product is the best on the market, yet I've not produced a single test since we made the purchase.  Is there another route via which we can resolve this?



    Thank you very much.



    Matt Carpenter
  • A few things I've learned while working with ExtJS apps:

    1) Reparenting items and enabling the Extended Find is a very useful approach, but must be used carefully, and even if you do it perfectly it still may not work as well as you'd like. Take care to choose an appropriate parent object, and be sure that you can find that object reliably.

    2) Be careful with the "className" property. ExtJS uses this property for all sorts of things, and it changes frequently on some objects. So be sure to thoroughly wildcard this property whenever you use it, and be aware that the value you see in the object browser will often have leading or trailing spaces that you can't see.

    3) ExtJS provides a "Name" property on most of the control classes, which is usually not used by developers, but if it is used will go into the ObjectIdentifier field in TC. If you can convince the developers to provide useful names on the important controls, then it makes finding them much, much easier than it is when you're stuck with names like "ext_gen123".

    4) Using the various Find methods is often more reliable than name mapping for these controls.



    That last one is probably the most significant lesson I've learned. I generally use name mapping to find an ancestor of the object I want, then use FindChild or FindAllChildren to locate the object itself.