Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Testing Excel Reports through QTP
#3
Not Solved
Hi Ankur,

I have now got my script to work like this:
I can scan through the excel from A1 to AA200 (this can be extended)
I can now look for particular error messages (like a string value)

The code is:

Code:
Set appExcel = CreateObject ("Excel.Application")
appExcel.visible=true
Set objWorkBook = appExcel.Workbooks.Open ("Q:\Results\Test.xls")  'opens the sheet
Set objSheet = appExcel.Sheets("Annual Balance Sheet")  ' To select particular sheet
wait(10)

Services.StartTransaction "check_errors"
'check for the error "#parsing error"
With objSheet.Range("A1", "AA200") ' select the used range in particular sheet

For each c in objSheet.Range("A1", "AA200")   ' Loop through the used range
    With c
     .Find ("#parsing error")' data to find  
     .Find ("@NA")' data to find  
If c="#parsing error"  then ' compare with the expected data
        c.Interior.ColorIndex = 32 'make the color if it finds the data
           print  "#parsing error found in this report"
        reporter.ReportEvent micFail, CheckForError, "#parsing error was found"
elseif c = "@NA" then
        c.Interior.ColorIndex = 30 'make the gray color if it finds the data
        print  "@NA error found in this report"
    reporter.ReportEvent micFail, CheckForError, "@NA error was found"
    End If
        Set c = .FindNext( c )   ' next search
    End with
Next
End With

Services.EndTransaction "check_errors"
objWorkBook.save
objWorkBook.close
window("Report_Excel_Window").close
set appExcel=nothing



Now instead of giving a particular name to the sheet ("Annual balance Sheet"- 4th line of the code) i want to make it more generic (like a .*)

Can i be able to use the regular expression?
I tried , but could not make it work.


Thanks
Velur
Reply


Messages In This Thread
RE: Testing Excel Reports through QTP - by Ankur - 11-18-2008, 08:53 PM
RE: Testing Excel Reports through QTP - by rajeshvelur - 11-20-2008, 02:03 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to write reports from scripts into excel anushreebehura 1 2,265 10-04-2016, 09:29 PM
Last Post: venkatesh9032
  Generate reports in qc using QTP tushar grover 0 2,272 10-22-2012, 03:00 PM
Last Post: tushar grover
  How to automate the crystal reports by using QTP Imtiaz-QA 0 4,246 09-29-2010, 11:57 AM
Last Post: Imtiaz-QA

Forum Jump:


Users browsing this thread: 3 Guest(s)