Geeks Talk

Prepare for your Next Interview


Welcome to the Geeks Talk forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Read and write data to a file in QC

This is a discussion on Read and write data to a file in QC within the QTP forums, part of the Software Testing category; How to read and write data to a file in QC using QTP Hi, How can we read a text file from QC using QTP. I need to read a ...

Go Back   Geeks Talk > Software Testing > QTP
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read
  #1 (permalink)  
Old 01-12-2008
Junior Member
 
Join Date: Dec 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
sairam100 is on a distinguished road
Read and write data to a file in QC

How to read and write data to a file in QC using QTP

Hi,
How can we read a text file from QC using QTP. I need to read a text file saved in QC , process it and save a text file into QC with the results. How can I do that using QTP File System Object ?

Thanks,
Sai
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 01-16-2008
Expert Member
 
Join Date: Jul 2007
Location: Kolkata
Posts: 182
Thanks: 7
Thanked 17 Times in 16 Posts
animesh.chatterjee is on a distinguished road
Re: Read and write data to a file in QC

Function initialization()
dim fso, msg
set fso = createobject("scripting.filesystemobject")
if (fso.fileexists("c:\p_qtp.ini")) then
fso.deletefile("c:\p_qtp.ini")
end if
set fso = nothing
call qc_create_folder()
if parameter("external_excel_flag")="true" then
setdata "reportpath",parameter("datatablepath")
setdata sexternal_excel,parameter("datatablepath")
setdata ssheetname,parameter("sheetname")
setdata bexternal_excel_flag,"true"
else var2=split(sqcresults&"\"&parameter("qc_excelreportpath"),"\")
var3=ubound(var2) reportfilename=var2(var3)
var4="" n2=ubound(var2)-1 for n1=0 to n2 var4=var4&var2(n1)&"\"
if n1=n2 then
var5=len(var4) qcreportpath=left(var4,var5-1)
end if
next
qc_importfile qcreportpath,reportfilename,getdata("files")
setdata "reportpath",getdata("files")&reportfilename
setdata "qcreportfilename",reportfilename
setdata "qcreportpath",qcreportpath end if
setdata "recovery","false"
setdata "qc_defectlog",parameter("qc_defectlog")
setdata "capture_screenshots",parameter("capture_screenshots")
setdata "qc_uploadscreenshots",parameter("qc_uploadscreenshots")
setdata "data_null",""
end function

Last edited by animesh.chatterjee; 01-16-2008 at 03:13 AM.
Reply With Quote
  #3 (permalink)  
Old 01-16-2008
Expert Member
 
Join Date: Jul 2007
Location: Kolkata
Posts: 182
Thanks: 7
Thanked 17 Times in 16 Posts
animesh.chatterjee is on a distinguished road
Re: Read and write data to a file in QC

Function QC_Create_Folder()
Dim fso, f,QCfolderpath

Set fso = CreateObject("Scripting.FileSystemObject")

QCfolderpath="C:\QC"&Month(Now)&day(now)&year(now)&Minute(time)&Second(Now)

Set f = fso.CreateFolder(QCfolderpath)

SetData "ParentFolder",QCfolderpath

SetData "Files",QCfolderpath&"\Files\"

SetData "ScreenshotPath",QCfolderpath&"\Screenshots\"

CreateSubFolder QCfolderpath,"Files"

CreateSubFolder QCfolderpath,"Screenshots"

Set fso = nothing

End Function
Reply With Quote
  #4 (permalink)  
Old 01-16-2008
Expert Member
 
Join Date: Jul 2007
Location: Kolkata
Posts: 182
Thanks: 7
Thanked 17 Times in 16 Posts
animesh.chatterjee is on a distinguished road
Re: Read and write data to a file in QC

In this way u need to initialize the folder ...make a download of the file targetted......edit....and upload the file ...



let me know if u need more help
Reply With Quote
Reply

  Geeks Talk > Software Testing > QTP

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
Read a file by Servlet Geek_Guest JSP 1 01-24-2008 05:18 AM
how we can read database file in C language? kavi12_nc C and C++ 2 01-16-2008 02:13 AM
How to Unzip the file when there is only Read Permission Geek_Guest Unix/Linux 1 08-03-2007 02:12 PM
How do you read and write to a serial port? Geek_Guest C# 0 07-19-2007 02:15 AM
The Read/Write Web Lokesh M HTML & CSS 0 06-21-2006 12:58 AM


All times are GMT -4. The time now is 04:02 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved