Forum Discussion

Blur's avatar
Blur
Contributor
9 years ago

Textnode problem

I map the textnode, "This field is required.", then I run the test.  Test fails because textnode cannot be found.  I check to see what's wrong and the problem is that every time I map the textnode, it'll increment by 1.  So without doing anything on the web page other than map that specific textnode, it'll increment by 1 which breaks my tests.  I have it wildcarded as well.  Any help would be appreciated, thanks.

 

2015-10-02 12_35_21-Automation.jpg

 

Edit:  Seems that TC 11 is just taking awhile to find the object that was already mapped.  I should be able to solve it by putting a 20s delay but I did not have this issue on TC 10.

 

Edit2: I decided to time how long it took TC 11 to find the mapped object.  It was roughly 2 minutes which is somewhat of a problem.

24 Replies

  • prasad92's avatar
    prasad92
    Occasional Contributor

    Hi,

     

    Note: This reply is done assuming you doing "scripting".

     

    I feel some times the objects which are already mapped in TestComplete requires lot of time beacuase of following reasons:

    • Mapping of objects is not done "end to end".
    • i.e. not all parent objects of the required object are mapped. Only few of the parent objects are mapped
    • Example if required object is "F" and hierarchy is A - B - C - D - E - F.
    • Then TestComplete may map A - C - F. Not all parent objects
    • Thus while run time (i.e. at playback time) TestComplete internally tries to implement "FindChild()" to find that object on page. This will certainly take some time, if the requried object is placed way down in the hierarchy.

    So what I do?

    • I don't map objects.

    Yes, I don't map objects. I simply do it scripting way.

    I do my own "end to end" mapping of those objects in my script. (mapping all parent objects). Thus no need to search object at run time and time gets saved.

     

    Sample code:

    //Controls
    var textBox_Username;
    var textBox_PasswordBox;
    var button_Login;
    
    //Mapping Function
    function MapObjectsForLogin()
    {
    	var LoginPage = Aliases.browser.LoginPage;
    	textBox_Username = LoginPage.Panel("LoginPanel").Panel("LoginPanelBody").Panel("LoginForm").Textbox("username");
    	textBox_PasswordBox = LoginPage.Panel("LoginPanel").Panel("LoginPanelBody").Panel("LoginForm").Passwordbox("password");
    	button_Login = LoginPage.Panel("LoginPanel").Panel("LoginPanelBody").Panel("LoginForm").Link("login");
    }
    
    //Login Sample Function
    function Login(username, password)
    {
    	MapObjectsForLogin();
    	textBox_Username.SetText(username);
    	textBox_PasswordBox.SetText(password);
    	button_Login.Click();
    }

     

     

    • Blur's avatar
      Blur
      Contributor

      I've only been using keyword testing because that's what was taught during the training.  For keyword testing, I  run into many problems.  I've tried not fully mapping the objects but that comes back to bite me later on.  If there are two textboxes and I don't map fully map them then TestComplete might see them as the same object.  Do you run into that issue with mapping via scripting?

      • jsc's avatar
        jsc
        Regular Contributor

        what really works for us:

        1) do the mapping first! map all the elements needed manually and disable automatic mapping as this will screw your mapping.

        2) check the mapping criteria for each item carefully. the criteria has to be unique so that the element will always be found. we use idstr or objectidentifier as often as possible (developers can set the value) or of this is not possible, select a unique label or similar stuff.

        3) use extended find for all mapped elements that have you have mapped as in 2) and remove all other stuff in between (like .panel, .cell, .table,...), which can change all the dtime.

    • Blur's avatar
      Blur
      Contributor

      Hey prasad,

       

      I just wanted to point out that I did not have a speed problem at all when I was on TC 10.  It's the exact same test but on TC 11 it takes 2 minutes to recognize that the object has been mapped.  My tests ran with almost no delay on TC 10.  I'm definitely going to try the suggestions but just find it odd that going to TC 11 would slow down my tests so much.

      • jsc's avatar
        jsc
        Regular Contributor

        did you already update to TC 11.11?

        TC 11.10 did have some problems.