10:29 PM
GAReddy
0
QTP - Files - Files Comparison
QTP - Files - Files Comparison
'************************************************************************
' GAReddy @ OneTestingCenter @ QTP @ Files Comparison
'************************************************************************
FilePath="D:\TestData\"
MyFile1="OnlineScriptLog.txt"
MyFile2="OnlineScriptLog1.txt"
ResultFile="D:\TestData\ResultFile.txt"
Call CompareFiles(FilePath, MyFile1, MyFile2)
Public Function CompareFiles(FilePath, MyFile1, MyFile2)
Const ForReading = 1
Const ForWriting = 2
Const BinaryCompare = 0
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set File1 = oFSO.OpenTextFile(FilePath & MyFile1, ForReading)
Set File2 = oFSO.OpenTextFile(FilePath & MyFile2, ForReading)
Set DiffFile=oFSO.CreateTextFile(ResultFile)
' *************************************************
' ****** To Count the number of lines in File1 ***********
'*************************************************
i=0
While
File1.AtEndOfStream <> True
Line1
= File1.ReadLine
i=i+1
Wend
' *************************************************
' ****** To Count the number of lines in File2 ***********
'*************************************************
j=0
While
File2.AtEndOfStream <> True
ln2
= File2.ReadLine
j=j+1
Wend
' *************************************************
' To Check if number of
lines in File1 and File 2 are equal
'*************************************************
If
i<>j Then
Reporter.ReportEvent 1, "Line Count
", "Line Count is not equal."
else
Reporter.ReportEvent 0, "Line Count
", "Line Count is equal."
End
If
File1.Close
File2.Close
' *************************************************
' To Read text from both files to compare
'*************************************************
Set File1 =
oFSO.OpenTextFile(FilePath&MyFile1, ForReading)
Set File2 =
oFSO.OpenTextFile(FilePath&MyFile2, ForReading)
Do While
((File1.AtEndOfStream <> True) AND (File2.AtEndOfStream <> True))
' Do While
((File1.AtEndOfStream <> True))
File1Line=File1.Line
File2Line=File2.Line
File1ReadLine
= File1.ReadLine
File2ReadLine
= File2.ReadLine
Comp =
StrComp( CStr(File1ReadLine),CStr( File2ReadLine), BinaryCompare)
'
*************************************************
' To wrtie
the comparison results on DiffFile
'*************************************************
If (Comp
<> 0) then
DiffFile.WriteLine "Contents are different"
&vbtab& File1Line &vbtab&
CStr(File1ReadLine) &"***"& File2Line
&vbtab& CStr(File2ReadLine)
Else
DiffFile.WriteLine "Contents are same" &vbtab
& File1Line &vbtab& CStr(File1ReadLine)
End if
Loop
File1.Close
File2.Close
DiffFile.Close
End Function
'************************************************************************
9:51 PM
GAReddy
QTP - Excel - Excel Comparison
QTP - Excel - Excel Comparison
How to compare two excel sheets (Expected and Actual Sheets)
How to compare two excel sheets (Expected and Actual Sheets)
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
' GAReddy @ OneTestingCenter @ QTP @ Excel Comparison
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
ExcelFilePath="D:\GAReddy\OneTestingCenter\QTP\TestData\"
ExpectedExcelBook=" D:\GAReddy\OneTestingCenter\QTP\TestData\QACompleteLearningReferense@AllOne.xls"
ActualExcelBook=" D:\GAReddy\OneTestingCenter\QTP\TestData\QACompleteLearningReferense@AllOne1.xls"
DifferenseSheet="MyExcelSheet.xls"
ActualSheet="Automation Testing"
ExpectedSheet="Automation Testing"
Call ExcelCompare(ExcelFilePath,ExpectedExcelBook,ActualExcelBook,DifferenseSheet,ActualSheet,ExpectedSheet)
Function
ExcelCompare(ExcelFilePath,ExpectedExcelBook,ActualExcelBook,DifferenseSheet,ActualSheet,ExpectedSheet)
Set
oExcel=Createobject("Excel.Application")
Set
oExpExcel=Createobject("Excel.Application")
Set
oActExcel=Createobject("Excel.Application")
Set
NewSheet = oExcel.Application.Workbooks.Add
Set
MySheet=oExcel.Application.Activeworkbook.Worksheets("sheet1")
oActExcel.Workbooks.Open
ActualExcelBook,2
oExpExcel.Workbooks.Open
ExpectedExcelBook,2
Set
oExpSheet=oExpExcel.Application.Activeworkbook.Worksheets(ExpectedSheet)
Set
oActSheet=oActExcel.Application.Activeworkbook.Worksheets(ActualSheet)
RowsCount
= oExpSheet.UsedRange.Rows.count
ColsCount
= oExpSheet.UsedRange.Columns.count
RowsCount1= oActSheet.UsedRange.Rows.count
ColsCount1= oActSheet.UsedRange.Columns.count
For
i=1 to RowsCount
For
j=1 to ColsCount
If
Trim(oExpSheet.Cells(i,j))<>Trim(oActSheet.Cells(i,j))Then
MySheet.Cells(i,j)=oExpSheet.cells(i,j)
&"***"& vbtab &
oActSheet.cells(i,j)
MySheet.Cells(i,j).Interior.Colorindex=34
else
MySheet.Cells(i,j)=oExpSheet.Cells(i,j)
End
If
Next
Next
MySheet.SaveAs
ExcelFilePath&DifferenseSheet
oExcel.Quit
oExpExcel.Quit
oActExcel.Quit
Set oExcel=Nothing
Set
oExpExcel=Nothing
Set
oActExcel=Nothing
End Function
GAReddy @ OneTestingCenter @ All Articles
- Ad-hoc Testing
- Automation Framework
- Basics of QTP
- Core Testing FAQs
- Download QTP - Preseenations
- Framework Guide
- Introduction to Testing
- ISTQB Foundation Level Exam Papers
- ISTQB Foundation Level Exam Sample Paper - I
- ISTQB Foundation Level Exam Sample Paper - II
- ISTQB Foundation Level Exam Sample Paper - III
- Keyword Driven Framework
- Keyword Driven Framework Complete Guide
- Keyword Framework Complete Guide
- Load
- Load Runner - Components
- Load Runner - Load Testing Process
- Load Testing - LoadRunner Correlation
- Load Testing Process
- Monkey Testing and Exploratory Testing
- Most Relevant Features and Benefits
- OneTestingCenter - Manual Testing - Learning Table
- Performance
- Performance Test - Short Notes
- Practical Guide to Keyword Driven Framework
- Programming Language / Scripting language / Markup languages / Operating Systems
- QTP QTP Learning Let's Learn QTP QTP Easy Learning QTP Guide QTP Book QTP Learning PDF QTP - Fundamentals QTP - Advanced QTP - Topic by Topic QTP Lessons GAReddy - QTP
- QTP - ActionDriven Framework Demo1
- QTP - Actions
- QTP - Application Relationship - Video
- QTP - Array Library Functions
- QTP - Automation Startup - Video
- QTP - Certification Q's1
- QTP - Certification Q's2
- QTP - Certification Q's3
- QTP - Data Tables
- QTP - DataTables - Video
- QTP - Descriptive Programing - Dynamic Object Repository Creation
- QTP - Descriptive Programming
- QTP - Descriptive Programming - Any Web App - Working with all Objects
- QTP - Descriptive Programming - Any Web App - Working with Web List-boxes
- QTP - Descriptive Programming - Broken Link Checking
- QTP - Descriptive Programming - Working with Any Web App
- QTP - Dictionary Object - Creating a Dictionary Object
- QTP - Dictionary Object - Add Method
- QTP - Dictionary Object - Items
- QTP - Dictionary Object - KeyExists
- QTP - Dictionary Object - Keys
- QTP - Dictionary Object - Remove Method
- QTP - Dictionary Object - RemoveAll Method
- QTP - Dictionary Object - Using Dictionary Values As Variables
- QTP - Environment Variables
- QTP - Excel - Excel Comparison
- QTP - Excel Comparision
- QTP - Files - Files Comparison
- QTP - Files Comparision
- QTP - Files Comparison
- QTP - FSO (PART A)
- QTP - FSO (PART B)
- QTP - Getting Object Properties Dynamically
- QTP - GetTOProperties / GetTOProperty / SetTOProperty Demo
- QTP - GetTOProperties Script Demo
- QTP - GetTOProperty Script Demo
- QTP - InputBox
- QTP - Keyword Driven Automation Framework - Video
- QTP - Keyword Driven Framework - Complete Guide
- QTP - Keyword Driven Framework - Complete Guide - Video
- QTP - Keyword Driven Framework - Step by Step Guide
- QTP - Microsoft Office - Word
- QTP - MsgBox
- QTP - Objects Classifications
- QTP - Overview
- QTP - Pass ByRef and Pass ByVal
- QTP - PDFs
- QTP - Recording Modes
- QTP - Recovery Scenario Manager
- QTP - Regular Expressions - Complete Reference
- QTP - Regular Expressions - Scripts
- QTP - Reporter Utility
- QTP - Reporter Utility - Scripts
- QTP - SetTOProperty Script Demo
- QTP - Synchronization
- QTP - Synchronization - Script Demo
- QTP - Synchronization Methods
- QTP - Synchronization Script
- QTP - Test / Action Template
- QTP - VBScript - Array Sorting
- QTP - VBScript - Dictionary Object
- QTP - VBScript and Data Types
- QTP - VBScript Functions - One Reference
- QTP - Videos
- QTP - Ways to synchronize
- QTP – Descriptive Programing – Any Web App - Working with Web Check Boxes
- QTP – Descriptive Programing – Examples
- QTP – Outlook Application
- QTP – Regular Expressions
- QTP – Web Tables
- QTP 10 Supports Windows 7 and IE8
- QTP Basics
- QTP Boks
- QTP Books
- QTP Complete Learning Table
- QTP Easy Learning
- QTP for Beginners
- QTP Info
- QTP Introduction
- QTP Learning
- QTP Learning MadeEasy. QTP QTP Learning Let's Learn QTP QTP Easy Learning QTP Guide QTP Book QTP Learning PDF QTP - Fundamentals QTP - Advanced QTP - Topic by Topic QTP Lessons GAReddy - QTP
- QTP Learning Materials
- QTP Simple
- QTP Videos
- Requirements Flow
- Roles and Responsibilities of Testers
- Software Testing - Core Testing Definitions
- Software Testing - FAQs
- Software Testing - Testing Methodologies
- Software Testing - Testing Process
- Software Testing Glossary : QA - Testing All in One
- Software Testing Process
- Stress Testing Requirements
- Stress testings
- Stress Testings - Why
- Test Case - Test Case Design Techniques
- Test Case - What is Test Case
- Test Case - What should a Test Case contain
- Test Case Designing Techniques
- Testing - Daily Status Report
- Testing - Defect - Defect Documenting
- Testing - Defect - Defect Life Cycle
- Testing - Defect - What is a Bug (Defect)
- Testing - Defect – Metrics
- Testing - Defect – Priority Levels
- Testing - Defect – Severity Levels
- Testing - Important FAQs
- Testing - Load Testing - Performance Testing - Stress Testing
- Testing - Requirements Flow
- Testing - UAT - Alpha Testing and Beta Testing
- Testing - Verification and Validation
- Testing Definitions
- Testing Methodologies
- Testing Terminologies
- VB Script Features
- What is Testing?
- When does the Testing begin?
- When does the Testing end?
- Why do we need Testing?
- Why does software have bugs?