Forum Discussion

pkudrys's avatar
pkudrys
Contributor
2 years ago

Code Completion does not work properly in Run Code Snippet

Hi guys,

 

Could anyone confirm the error I'm recently experiencing with code completion in Run Code Snippet? Basically, the code completion only barely works and if it works, it does not display all available methods.

 

In below screenshot, I'm trying to add Run Code Snippet, which should click on an object returned by FindChild method. It seems the Code Completion does not work as expected. When I enter 'dot' after the object variable name, code completion is not displayed at all. It just blinks. I would expect that the Code Completion is displayed, with the list of all available methods? But nothing happens.

 

Once 'dot' is deleted, code completion is displayed, but still with only some methods. I can manually enter Click() method, which I know for sure works. But there is no way to select it from the code completion list. Am I using it wrong?

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    Variables in TestComplete can reference any object or contain just a value. Thus it is not possible to predict what methods/properties can be used at the given line of code and thus Code Completion displays methods/properties for built-in objects only.

    So, I would say that the observed behavior is correct and expected. (Yes, it is not completely convenient, but I have no idea of how it can be improved.)

     

    P.S.

    I can manually enter Click() method, which I know for sure that works.

    .Click() method will work only if the sought for button is found and continues to exist. Otherwise an empty stub object that does not contain .Click() method is returned and call to .Click() fails.

    This is to illustrate how difficult it might be to implement Code Completion that will work as most of us expect.

     

  • Hi Alex,

     

    Thanks for the reply. It definitely makes sense in case of unpredictable variables. However, in case of LogParams parameter, it's kind of built-in object, with the list of available properties. So I think the code completion should work with it? Or am I wrong? And one more thought regarding variables, I think the Code Completion should work (maybe limited) with them too, based of the variable data type? Yes, I'm somehow biased as I'm coming from the Ranorex word and code completion definitely works that way there 😉

  • And here is another example of the problem. Apparently, it's not isolated to just keyword tests, but it happens in script modules too. In case of Keyword test, the code completion briefly appears after entering 'dot' behind the LogParams parameter or after using shortcut Ctrl+Space. In keyword test, the code completion window seems appear a bit longer, in case of script module, it only blinks.