Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE
qtp24 Respected Contributor.
Respected Contributor.
863 views

Record file system using QTP

Jump to solution

Hi,

 

I am trying to search a specific folder in D:\test directory using QTP. I did spy on the folders. It seems to me all the folders in a containter object. QTP does not recognize folders seperately. Any help?

 

-Q

0 Likes
1 Solution

Accepted Solutions
qtp24 Respected Contributor.
Respected Contributor.

Re: Record file system using QTP

Jump to solution

I am using qtp 11.

 

Not sure what to answer to your question.

 

Example: In C:\Test directory, folders are being created automatically from a VB application. Each time VB application creates a folder, I need to come to C directory to verify whether the folder was created.

 

Folders names will be test1, test2, test3, qtp1, qtp2, qtp3.

 

When a new folder gets created with prefix test, the next folder name will be test4. When a new folder gets created with prefix qtp, the fourth qtp folder name will be qtp4, so on.

 

I need QTP to find out whether the new folder has created with the same prefix in the given directory.

 

0 Likes
3 Replies
Absent Member.. Trudy Claspill Absent Member..
Absent Member..

Re: Record file system using QTP

Jump to solution
What version of QTP are you using?

Are you using QTP to interact with a Windows Explorer dialog, or are you using vbscript code to interact with the file system?
[If this post solves or helps solve your issue, mark the thread as solved and give KUDOS to the author for their assistance.]

(Opinions expressed in my postings are mine alone, and do not reflect the opinions of my employer.No warranties express or implied for any solution/suggestion posted.)
0 Likes
qtp24 Respected Contributor.
Respected Contributor.

Re: Record file system using QTP

Jump to solution

I am using qtp 11.

 

Not sure what to answer to your question.

 

Example: In C:\Test directory, folders are being created automatically from a VB application. Each time VB application creates a folder, I need to come to C directory to verify whether the folder was created.

 

Folders names will be test1, test2, test3, qtp1, qtp2, qtp3.

 

When a new folder gets created with prefix test, the next folder name will be test4. When a new folder gets created with prefix qtp, the fourth qtp folder name will be qtp4, so on.

 

I need QTP to find out whether the new folder has created with the same prefix in the given directory.

 

0 Likes
Highlighted
Absent Member.. vzamoraz Absent Member..
Absent Member..

Re: Record file system using QTP

Jump to solution

Hello,

 

    You can use filesystem to get that.

    

Set fso=createobject("Scripting.FileSystemObject")
'Folder  for  getting details  
Sourcefolder="C:\Test"  
Set get_folder=fso.GetFolder(Sourcefolder) 
'get the subfolders count in a folder
Set  get_subfolder=get_folder.SubFolders
For  each  folder  in get_subfolder
'compare folder name
If folder.name = "expected value" then
'process to do
end if 
Next
Set fso=nothing

Regards.

If you find that this or any post resolves your issue, mark it as an accepted solution.

 

The code provided above is free and is just a sample, you need to adapt it and maintain it according to your needs.

 

Also remember if you have a valid contract with HP feel free to visit our FT/QTP Support Customer Forums:

 

http://h30499.www3.hp.com/t5/Functional-Testing-QTP/ct-p/sws-Fun_Test

 

You can create an account with your HP credentials

 

 

 

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.