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. |
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?...
|
|||||||
|
|||
|
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. |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
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 |