Forum Discussion

cjfoeller0404's avatar
cjfoeller0404
Occasional Contributor
7 days ago
Solved

How to Create/Import Description File for JavaScript - Inquiry

I am attempting to add a description that appears in the AutoComplete Menu for various functions as can be seen with many of the built in functions/methods for a Javascript file. How would I go about doing so?

So far I have attempted creating a description.xml file for one of my JavaScript Files and put the file in the same directory with my JavaScript files (./Scripts/). Is there a process I need to perform to actually import this file into the project?
Also, assuming this description.xml file can perform the my desired action, can it be used to add descriptions to functions/methods for multiple JavaScript files? I would assume this is by having multiple of the <Script> tags in the xml, though want to confirm before further proceeding down this route.

Below are images of what I am trying to accomplish, in case I am going down the wrong route entirely:


Current state: Desired State:

 

I have also attached the description.xml file I am using in attempting this.

Please let me know if any additional information is required!

9 Replies

    • cjfoeller0404's avatar
      cjfoeller0404
      Occasional Contributor

      So yes, that is around the path I am looking for. Though maybe on different rails.

      So to add more context to what I am doing, effectively I have some libraries of javascript files in my TestComplete project, that contain various functions/methods. So this isn't a standalone package that I am trying to build that can be imported into other TestComplete Projects. I am attempting to have that AutoComplete Window populate a description for the same JavaScript file or others in the same project being used via "//USEUNIT [Filename]".

      I guess what I am asking is how do I get the "description.xml" file to talk to the .js files in a TestComplete project to populate the AutoComplete Sections shown in the images above in continuing to add functions inside of that same project? 

      Let me know if that doesn't make sense, I'm not certain if I am explaining that correctly.

      • scot1967's avatar
        scot1967
        Icon for Champion Level 1 rankChampion Level 1

        Again, I have never actually done this but my research seems to indicate it is possible if you are creating a .tcx package to import as a script extension in TestComplete.  I don't think adding a description.xml is possible any other way.

        Maybe rraghvani has worked with this?  His response indicates this will not work.  However I am not certain he is taking custom script extensions into account.

        This indicates you are not creating a script extension however. So I defer to rraghvani 

        So this isn't a standalone package that I am trying to build that can be imported into other TestComplete Projects. I am attempting to have that AutoComplete Window populate a description for the same JavaScript file or others in the same project being used via "//USEUNIT [Filename]".

  • scot1967's avatar
    scot1967
    Icon for Champion Level 1 rankChampion Level 1

    I haven't done this myself.  There is info here related to creating and importing script extensions you have written and want to use in TestComplete.  I don't know if altering the descriptions you have shown in your images is supported however.  Let us know!

    Extending TestComplete:

     

    Creating the Description File:

    ... If you find my posts helpful drop me a like! πŸ‘ Be sure to mark the best answer if you get one to help others out and to credit the one who helped you.  😎

  • rraghvani's avatar
    rraghvani
    Icon for Champion Level 3 rankChampion Level 3

    While TestComplete supports JavaScript (and other scripting languages), its editor and IntelliSense features are not as rich as those like VS Code. TestComplete IntelliSense will not fully parse JSDoc-style comments, as shown below.

    I suggest you provide similar comments, as a lookup for your users

    • cjfoeller0404's avatar
      cjfoeller0404
      Occasional Contributor

      Hmm, alright. I will likely put in a future request and look into work arounds for my teams solution. Thank you!

      • rraghvani's avatar
        rraghvani
        Icon for Champion Level 3 rankChampion Level 3

        I also looked into this a while back, then came to the conclusion that TestComplete doesn't support JSDoc-style comments. 

        Within my Project Suite, I have a Project called Common. Within the Common project, I've declared a "helper class" which I can access from any other projects within the project suite. It's basically a bunch of methods in a singleton class, that I constantly use to call various routines to perform various actions. 

        I suggest you try and keep things as simple as possible, and eventually the users will get familiar with methods/parameters etc