Forum Discussion

vthomeschoolmom's avatar
vthomeschoolmom
Super Contributor
6 years ago

find unused script routines

Is there an easy way to find all script routines that are not called anywhere, by other scripts or by keyword tests? Thanks

  • TanyaYatskovska's avatar
    TanyaYatskovska
    6 years ago

    Hi Guys,

     

    The Finding Usages article says that:

    TestComplete does not support searching for usages in script units associated with other units through adding the module.exports object.!


    So, the behavior you see is expected.

    As an alternative, you can find occurrence via the Search/Replace dialog.

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    If you're using TestComplete 12.60, you should be able to right click on the routine and select "Find Usages".  That will then return all script references and Keyword test references to that script routine.

    • vthomeschoolmom's avatar
      vthomeschoolmom
      Super Contributor

      That does not appear to work consistently. For instance, I have a function called GetRandomString(). It is called many times across various script functions. When I do find instances for that function, my search results show no results.

       

      Is there something I need to do that I am missing? Thanks

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        I wonder if it might have to do with the implementation.  How are you using that script in other locations?  Are you using \\USEUNIT or are you using the native JavaScript "import"?