EmmaQuinn's avatar
EmmaQuinn
New Contributor
9 years ago
Status:
New Idea

Variables - Find Unused / show where used

I have created 100s of variables over the last couple of years and have no way of knowing if they are now redundant / where I am using them

 

It would be useful to be able to see a list of variables that are not used in any tests and to see a list of tests that variables are used in.

  • mgroen2's avatar
    mgroen2
    Super Contributor

    Great suggestion. If I remember correctly I have asked for the same feature request months/years ago. (searched for it on the forum but couldn't find it though)...

    Hope it will be implemented in future version of TC !

  • cunderw's avatar
    cunderw
    Community Hero

    if you don't mind working with powershell here is a script that will give you results. File extensions might need to be changed. 

    write-host "This script searches all TestComplete Script and Key Word Test files for specified Search String"
    $searchString = Read-Host "Enter the string to search for: "
    if ($PSVersionTable.PSVersion.Major -LT 3) 
    {
        get-childitem -include *.tcKDTest, *.sj -path <path to test repository> -recurse | select-string -pattern $searchString |  select filename, path, line -unique | out-gridview
        read-host "Press enter to continue..."
    }
    ELse
      {
         get-childitem -include *.tcKDTest, *.sj -path <path to test repository> -recurse | select-string -pattern $searchString |  select filename, path, line -unique | out-GridView -passthru | ForEach-Object {start "C:\Program Files (x86)\Notepad++\notepad++.exe" $_.Path}
       }