I am new to QTP, and would like to know an easy way to do search inside of QTP. For example, I see a function in one of the test script, and I would like to find out where else it is being used, and get some ideas on its use, how do i Search for that?
I used Rational Functional Tester before, and in there I just selected search, entered a function name, and selected search in all files. In the end I got a complete list of all the files where this function was used. I am looking to find out if there is something similar in QTP.
I had a similar situation earlier, below ground work i did to achieve what you asked for.
1. I had a list of functions used in my project using function library.
2. created a array with list of this function
3. I have saved all the scripts(.mts) saved in local drive with hirarchey or as per your logic with some name login.mts, search.mts or Login folder(login.mts)
4. In the DataTable have column name as Script_name and all the functions
5. Loop through the code and fetch how many times it repeated to get count.
Const ForReading = 1
Set fso = CreateObject( "Scripting.FileSystemObject" )
Set textFile = fso.OpenTextFile( MyFile, ForReading )
contents = textFile.ReadAll
i = 0
linesArray = Split( contents, " " )
For Each lineStr in linesArray
If InStr( lineStr, strFunction(ArrArray(x)) Then
i = i + 1
msgbox "Number of function"&strFunction(ArrArray(x))&"No of itmes it's called:"&i
I just use a 3rd party tool called WildReplace by Cylog. Save your QTP test some place other than QC, like on your local pc or network share, and you can search for a string in all the files. You can do mass replaces too.
It's free, and there is a portable install option, so you don't need admin rights to install it.