Forum Discussion

littlebear's avatar
littlebear
Contributor
19 days ago

Improve test performance message creating blank selectors

Hello,

In my test, I am manipulating my selector for an object using variables. It only has one selector. For example:

//div[@role='main']/div[%ProjectDiv%]

Because of this, I am frequently getting Log messages (previously they were warnings) telling me to improve my performance by making a given selector, that I don't currently have, the first selector for an object. Like this selector, for instance:

//div[@role='main']/div[1]

For curiosity's sake, I will "improve my performance", and when I do so my objects selectors look like this: 

This is quite weird, and it will certainly not help my test's performance. Does anyone know of a way to either remove these messages or help Testcomplete recognize the variable selector is best once and for all?

Thanks you,

  • Hello,

    Long ago, I reported to SmartBear this "improve my performance" feature resulting in an "Empty" entry, and gave up on using it.

    Also I learned to ignore the log messages of "improve my performance" as they do not make sense since my constructed XPath is a simple one.

    I have been using string variables %Button% = 'Save', I did not try integer variables %ProjectDiv% = 1, could that make a difference?

    To minimize these occurrences, keep in mind that NameMapping Aliases have parent child multi level structure, where Mapped objects are page and a flat out list of nodes. If your Mapped objects also consist of parent child multi level structure, you will get such performance message. 

    Hope this is helpful.

  • Hello,

    Long ago, I reported to SmartBear this "improve my performance" feature resulting in an "Empty" entry, and gave up on using it.

    Also I learned to ignore the log messages of "improve my performance" as they do not make sense since my constructed XPath is a simple one.

    I have been using string variables %Button% = 'Save', I did not try integer variables %ProjectDiv% = 1, could that make a difference?

    To minimize these occurrences, keep in mind that NameMapping Aliases have parent child multi level structure, where Mapped objects are page and a flat out list of nodes. If your Mapped objects also consist of parent child multi level structure, you will get such performance message. 

    Hope this is helpful.

    • littlebear's avatar
      littlebear
      Contributor

      I've changed my parts of my Namemapping file to the multi-level structure, because I thought that would make it faster? I don't know if that's true though. Your advice is helpful.

      • Hassan_Ballan's avatar
        Hassan_Ballan
        Contributor

        I would think it would make it slower as multiple searches needs to take place, hence the performance message. In a single XPath search you can find your element, and you can construct it to find parent than find child
        //div[.='branch']//div[.='parent')]//a[.='element']

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    If it's not hampering your automation, then it's probably best to ignore it.