Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Search in Excel / DataTable
#2
Solved: 11 Years, 5 Months ago
Hi,
All seniors please give your comments, If I'm doing any thing wrong.

I'm also new to QTP and using the same Data Driven frame work using Excel work sheets. It is working great for me.
What i'm doing is, I'm using two work sheets (one for Expected values and other is for Actual results and comparison) instead of two work books so, I can mention only one excel path in my test.
the code I used is,
Code:
strExcelPath = "C:\Automation\QTP_ResultsNReport.xls"
Set  objWorkbook = objExcel.Workbooks.Open (strExcelPath)
' reading values from Expected Values worksheet
set ExpectValues = objExcel.ActiveWorkbook.Worksheets("ExpectedValues")
ExpctValue1 =  ExpectValues.cells(1, 1)
ExpctValue2 =  ExpectValues.cells(1, 2)
ExpctValue3 =  ExpectValues.cells(1, 3)
' reading values from Actual Values worksheet
set ActValues = objExcel.ActiveWorkbook.Worksheets("ActualValuesNResults")
ActValues1 =  ActValues.cells(1, 1)
ActValues2 =  ActValues.cells(1, 2)
ActValues3 =  ActValues.cells(1, 3)
' Now compare both Expected and Actual values
if ExpctValue1 = ActValues1 then
     if ExpctValue2 = ActValues2 then
        if ExpctValue3 = ActValues3 then
            TestStatus = "Pass"
        end if
     end if
else
    TestStatus = "Fail"
End if

Hope this make sense to your question. let me know.
You can put lots of more masala code into this methodology.
View the attached spreadsheet image. it will give you a rough idea what I'm trying to do.

Ram.


Attached Files Image(s)
   
Reply


Messages In This Thread
Search in Excel / DataTable - by idolast - 01-22-2008, 06:41 PM
RE: Search in Excel / DataTable - by idolast - 01-23-2008, 05:38 PM
RE: Search in Excel / DataTable - by newqtp - 01-23-2008, 11:21 PM
RE: Search in Excel / DataTable - by vramu1 - 01-24-2008, 06:32 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  CyberArk CorePAS REST API to search for accounts pramod 0 866 06-29-2023, 03:11 PM
Last Post: pramod
  Search All Test scripts For a Function? AndyBSG 1 2,786 02-19-2015, 04:15 AM
Last Post: supputuri
  Search for a string in all the files under all subdirectory Mahesh27 1 2,245 07-03-2013, 03:24 PM
Last Post: Sathiya
  Testing Search box kriday 1 2,555 06-26-2013, 08:51 AM
Last Post: basanth27
  Search for a word in excel string QAVA 6 9,461 11-23-2012, 11:17 AM
Last Post: vinod123

Forum Jump:


Users browsing this thread: 2 Guest(s)