Micro Focus QTP (UFT) Forums
location function - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: location function (/Thread-location-function)



location function - Anamika sinha - 05-10-2011

hello,

can any one please explain below function:

i understand function object but "TestLocation=objQTP.Test.Location" in this line i am not understand "Test" role.

Code:
FUNCTION GetFileLocation (ByRef sFolderName, ByRef sFileName)

   Dim objQTP
   Set objQTP = CreateObject("QuickTest.Application")
   TestLocation=objQTP.Test.Location
   var=split(TestLocation,"\")
   i=UBound(var)
   var(i-1)=sFolderName
   var(i)=sFileName
   TestDataLocation=join(var,"\")
   GetFileLocation = TestDataLocation
   Set objQTP = Nothing
  
END FUNCTION



RE: location function - supputuri - 05-10-2011

Hi,

The test method will bring the current test into context.
But, I don't understand what your doing here. Can you tell me what was your insight of this function?
Why you need this function?

Thanks,
Sri


RE: location function - Anamika sinha - 05-10-2011

Thanks, actually in this function i am simply retrieve excel sheet location for import data sheet in script................

if possible please explain this in brief



RE: location function - supputuri - 05-10-2011

Hi,
You can use environment inbuilt variable to get the location of you test and use that.
Code:
'Paste this code in a saved test
msgbox Environment("TestDir") ' you can see the location of your test
Let me know if you need any more info.