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,
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.
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.