Results 1 to 4 of 4

Thread: Read and write data to a file in QC

  1. #1
    Junior Member
    Join Date
    Dec 2007
    Answers
    2

    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


  2. #2

    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.

  3. #3

    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


  4. #4

    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


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact