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.

scripting

This is a discussion on scripting within the QTP forums, part of the Software Testing category; how write basic script inQTP? What are the things need to be followed while writing the script? send some sample script for web application?...

Go Back   Geeks Talk > Software Testing > QTP
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read
  #1 (permalink)  
Old 07-06-2007
Junior Member
 
Join Date: Jul 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
sudhakartrk is on a distinguished road
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?
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 01-04-2008
Junior Member
 
Join Date: Dec 2007
Location: hyderabad
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
sekhar.vch is on a distinguished road
Re: scripting

Hi

How to compare two text files using qtp.
Reply With Quote
  #3 (permalink)  
Old 01-04-2008
Expert Member
 
Join Date: Oct 2007
Location: Mumbai
Posts: 354
Thanks: 4
Thanked 58 Times in 47 Posts
bizzzzzare will become famous soon enough
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....
__________________
Regards,

V.Umesh Krishnan
QA Consultant

Last edited by bizzzzzare; 01-04-2008 at 09:35 AM.
Reply With Quote
  #4 (permalink)  
Old 01-04-2008
Moderator
 
Join Date: Oct 2007
Location: Frankfort, KY
Posts: 283
Thanks: 3
Thanked 54 Times in 36 Posts
Anshoo_Arora is on a distinguished road
Re: scripting

You can also use WDiff to compare 2 text files.
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
Server-side Scripting Languages in ASP.NET? Srikanth ASP.NET 4 06-23-2008 01:32 AM
Shell Scripting questions Geek_Guest Unix/Linux 4 11-05-2007 02:05 AM
Where we have to go for Siebel Scripting bhaanu Seibel 2 10-08-2007 10:15 AM
Scenario where we have to go for Scripting bhaanu Seibel 0 06-21-2007 03:44 AM


All times are GMT -4. The time now is 04:27 PM.


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