Interview Questions   Tutorials   Discussions   Programs   Videos   

QTP - What is a file system object in QTP?

asked marvit August 19, 2014 02:20 AM  

What is a file system object in QTP?


1 Answers

answered By Dharma   0  
QTP provides various features and built-in functions to handle the folder structure. By using “filesystemobject ”  you can easily work on folders and files.this is commonly used object for parameterization

there are several methods provided with fileobjectsystem in this post we will see some commonly used method with the example

BuildPath Method

    Appends a name to an existing path. The BuildPath method inserts an additional path separator between the existing path and the name, only if necessary
Function GetBuildPath(path)
  Dim fso, newpath
  Set fso = CreateObject("Scripting.FileSystemObject")
  newpath = fso.BuildPath(path, "Sub Folder") 
  GetBuildPath = newpath
  End Function
Close Method
    This method is used to close the open TextStream file. if you open any file for reading for writing purpose then you should close it once you complete with the operation.

object.Close( );

  Sub CreateAFile
    Dim fso, MyFile
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set MyFile = fso.CreateTextFile("c:testfile.txt", True)
    MyFile.WriteLine("This is a test.")
  End Sub

   add comment

Your answer

Join with account you already have



Ready to start your tutorial with us? That's great! Send us an email and we will get back to you as soon as possible!