Automation testing QTP with VB Script functions Interview questions


Total available count: 68
Subject - Software Testing
Subsubject - Automation testing QTP with VB Script functions

Method: Read?

It reads a specified number of characters from a TextStream file and returns the resulting string.

Syntax: strChars = objTso.Read(numCharacters)

Arguments:
objTso: (Required) The name of a TextStream Object previously instantiated.
numCharacters: (Required) The number of characters you want to read from the file

Example:    

Set fso=createobject("Scripting.FileSystemObject")
'Open the file "qtptest.txt" in writing mode.
Set qfile=fso.OpenTextFile("C:qtptest.txt",2,True)
'write contents to the file into two newlines.
qfile.Writeline  "Welcome to the World of QTP"
qfile.Writeline  "the file name is qtptest.txt"
'Open the file "qtptest.txt" in reading mode.
Set qfile=fso.OpenTextFile("C:qtptest.txt",1,True)
'Read  characters from the file.
Msgbox  qfile.Read(10)                 
'Output --> "Welcome to"  will be read
'Close the files.
qfile.Close
'Release the allocated objects.
Set qfile=nothing
Set fso=nothing

 




Next 5 interview question(s)

1
Method: ReadAll?
2
Method: ReadLine?
3
Method: Write?
4
Method: WriteLine?
5
Method: WriteBlankLines?

Comments