what is a file system object in QTP

Answer Posted / sreeprasad

File System is used to create file through scripting.We can

read, write and save data in txt file and use it after

wards during testing. Here is example of creating txt file

through FSO

Const ForReading = 1, ForWriting = 2

Dim fso, MyFile

Set fso = CreateObject("Scripting.FileSystemObject")

Set MyFile = fso.OpenTextFile("c:testfile.txt",

ForWriting, True)

MyFile.WriteLine "Hello world!"

MyFile.WriteLine "The quick brown fox"

MyFile.Close

Set MyFile = fso.OpenTextFile("c:testfile.txt",

ForReading)

ReadLineTextFile = MyFile.ReadLine ' Returns "Hello

world!"

It will create testfile.txt and enter "This is a test" in

that text file. You can later read that line "This is a

test" from this file while using

MyFile.ReadLine

We can save variables data during testing and then use that

data in future instances of testing and then delete that

file.

Is This Answer Correct ?    19 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

how to write the descriptive programming in QTP for remove the object value and substitute, with a variable then call the validation from excel

1994


How to read a text file from QC using QTP. I would like to do something like this. But instead read a file from QC and NOT from my local drive. Set fso = CreateObject("Scripting.FileSystemObject") Set InputFile = fso.OpenTextFile("C:\test.txt", ForReading) Thanks

2859


Write a QTP script to enter a keyword in to Google search engine?

747


How you debug your script?

650


What do you mean by iteration?

731






What is optional step in qtp? How you can add optional step in qtp?

627


Which HTML specification will be adhered to? How strictly? What variations will be allowed for targeted browsers?

648


Is QTP supports Unix. If yes, then how the test automation is done?

1826


How to capture all the data of a webtable, weblist and combolist using QTP?

2935


Hi,All How to create a link in excel sheet using qtp

3091


What is QTP scenario.

1817


Hi frens! I am testing VB project with MS Access database. At add button click my record is storing in data table and it is shown in datagrid. So at Delete button click i want to check datagrid rows 9before and after delete). so how can i do it using descriptive programming?

1585


suppose i login into gmail page after that i read all the messages (say 10 messages) i have to send (SAVE) the messages in Html,notepad and i have to replay(Compose) send the messages please give me the code and give mail id so that i can clear my question

1577


Is it possible to use two instances of UFT on the same machine? If not why?

709


I want to write some certification courses, so friends could you guide me? which certification is best and how to write exam and what tutorials need to be studied,what to do first, I am working on automation tool QTP 9.2

1594