Results 1 to 4 of 4

Thread: scripting

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

    scripting

    how write basic script inQTP?
    What are the things need to be followed while writing the script?
    send some sample script for web application?


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

    Re: scripting

    Hi

    How to compare two text files using qtp.


  3. #3
    Expert Member
    Join Date
    Oct 2007
    Answers
    375

    Smile Re: scripting

    Hi Sekhar,

    Check out the below code. It will compare both the text files and isolate the differences found in the file1 which are not present in file 2 in a seperate ouput file.
    To make it simpler , consider 2 text files - text1 and text2. This code would compare both the files and would log difference rows present in text 2 in a seperate file called as output.txt.

    This is a vbscript code. So create a .vbs file and include it as a library function in your action.

    code.

    dim found
    set objfso = createobject("scripting.filesystemobject")
    set objinputfile2 = objfso.opentextfile ("c:\text2.txt")
    set objoutputfile = objfso.createtextfile("c:\output.txt")

    do until objinputfile2.atendofstream
    found = false
    strnextline2 = objinputfile2.readline
    set objinputfile1 = objfso.opentextfile ("c:\text1.txt")

    do until objinputfile1.atendofstream
    strnextline1 = objinputfile1.readline

    if (strnextline2 = strnextline1) then
    found = true
    end if
    loop

    objinputfile1.close

    if (found = false) then
    objoutputfile.writeline strnextline2
    end if
    loop

    objinputfile2.close
    objoutputfile.close
    set objinputfile1 = nothing
    set objinputfile2 = nothing
    set objoutputfile = nothing

    Let me know incase you face any difficulties with the code,

    cheers....

    Last edited by bizzzzzare; 01-04-2008 at 08:35 AM.

  4. #4

    Re: scripting

    You can also use WDiff to compare 2 text files.


  5.  Sponsored Ads
    Ad


     

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