Forum Discussion

eykxas's avatar
eykxas
Regular Contributor
2 years ago

Testcomplete is slow to performs basics operations.

Hi everyone !

 

I have an annoying issue with TC since the last update. (15.47.4.7 x64).

Basics operations like Click(), obj.Text = "some string" etc... take a long time to execute. About 3 to 4 seconds.

 

For example I have a very simple login page.

 

it's just a td/tr with some elements (two input, one button)
Searching accross this dom, is really fast for TC. Nearly instantaneous.

this is the code (javascript) : 

in this code almost all lines are executing fast except : input1.Text = login, input2.Text =  password and button.Click().
Before the update (I don't remember the version, maybe 15.41) this code took less than a second to execute, now it take 8 seconds in the best case.

 

 

function login(login = Project.Variables.login, password = Project.Variables.password){
  
  var page = Aliases.browser.pageLogin;   
 
  var input1 = page.Find("ObjectIdentifier", "input_1", 7, false);
  var input2 = page.Find("ObjectIdentifier", "input_2", 7, false);
  var button = page.Find("ObjectType","SubmitButton", 7, false);

  if(input1.Exists){
    input1.Text = login;
  }else{
    Log.Error("input1 not found");
    return false;
  }
  
  if(input2.Exists){
    input2.Text = password;
  }else{
    Log.Error("input2 not found");
    return false;
  }
  
  if(button.Exists){
    button.Click();
    Log.Message("Connection ok");
    return true;
  }else{
    Log.Error("button not found");
    return false;
  }
}

 

 

 
I don't understand why the operations is so long. Thx.

  • Hi,

    after some investigations, I finally found the problem and resolved it. It was the NameMapping.
    To optimize the search of objects in our app, we created a custom NameMapping and organized the Aliases in a hierarchical way. So in script, we can do this :

     

    var obj = Aliases.browser.app.containerOne.subContainerTwo;

     

    and use this object as a starting point for the Find and FindAll method. This, indeed, speed up the script wihout increasing the number of searching level. But it has a huge impact on some operations of TC and in the object browser too.

    To resolve this, I deleted all the objects in the NameMapping, and replace it with a custom method "getContainer" using a Map() inside. Basically, it do the same thing for our project.

    Instead of Aliases, now we have : var obj = getContainer(string); and the method return an object by its xpath.