Ask a Question

Variables - Find Unused / show where used

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.

3 Comments
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
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}
   }

 

EmmaQuinn
New Contributor

Thanks very much @cunderw

Announcements
Welcome to the TestComplete Feature Requests board!

Here you can review submitted feature requests and vote up the ones you like! If you can't find the feature you want - go ahead and suggest your own idea. Ideas with the highest rating can be implemented in the product.

Check out the Create a Feature Request guide for more information.
New Here?
Join us and watch the welcome video:
Announcements