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: Write?

It writes a specified string to a TextStream file.

Syntax: objTso.Write(string)

Arguments:
objTso: (Required) The name of a TextStream Object previously instantiated.
string: (Required) The text you want to write to 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 a single line.
qfile.Write  "Welcome to the World of QTP"
qfile.Write "the file name is qtptest.txt"
'Open the file "qtptest.txt" in reading mode.
Set qfile=fso.OpenTextFile("C:qtptest.txt",1,True)
'Read  the entire contents of  priously written file.
Do while qfile.AtEndOfStream <> true
 'Output --> The file will contain the above written content  in  single line. 
Msgbox  qfile.ReadLine
Loop
'Close the files.
qfile.Close
'Release the allocated objects.
Set qfile=nothing
Set fso=nothing

 




Next 5 interview question(s)

1
Method: WriteLine?
2
Method: WriteBlankLines?
3
Property: AtEndOfLine?
4
Property: AtEndOfStream?
5
Explain TimeValue Function?

Comments