Hi All,
Please find attached the script I prepared to solve my problem.
Would appreciate your inputs on the same and other ways of doing the same in
more efficient or better way.
Regards
Shalabh Dixit
On Wed, Mar 30, 2011 at 3:55 PM, shashank shekhar raj <
[email protected]> wrote:
> Tell me also how you did this.
>
> On Wed, Mar 30, 2011 at 12:32 AM, Shalabh Dixit
> <[email protected]>wrote:
>
>> I'm done with it..!!
>>
>> On Mar 29, 8:33 pm, Shalabh Dixit <[email protected]> wrote:
>> > Test case ID
>> > Database1 Database2
>> >
>> ---------------------------------------------------------------------------
>> ---------------------------------------------
>> > 1 select count(*) TotalRecords
>> > from select count(*) TotalRecords from
>> > TableA where
>> > abc='12' TableA where abc='12'
>> >
>> ---------------------------------------------------------------------------
>> ---------------------------------------------
>> > 2 select count(*) TotalRecords
>> > from select count(*) TotalRecords from
>> > TableB where
>> > abc='12' TableB where
>> > abc='12'
>> >
>> ---------------------------------------------------------------------------
>> ---------------------------------------------
>> > 3 select count(*) TotalRecords
>> > from select count(*) TotalRecords from
>> > TableC where
>> > abc='12' TableC where
>> > abc='12'
>> >
>> ---------------------------------------------------------------------------
>> ---------------------------------------------
>> > Hi All,
>> >
>> > I have 1 excel template like above containing 3 columns namely
>> > TestcaseID, Database1,Database2 as shown above. col2 and col3 contains
>> > queries from tables for each database resp.
>> > What I want is to execute each queries in the sheet corresponding to
>> > each testcaseID and then compare the result of two queries... i.e
>> > queries contains Count(*) function so I want to compare the value of
>> > the two queries for each testcase ID.
>> > Similarly there are many testcases for which i need to perform the
>> > same operation.
>> >
>> > Can anybody pls provide their inputs on it.
>> >
>> > Thanks
>> > Shalabh
>>
>> --
>> You received this message because you are subscribed to the Google
>> "QTP - HP Quick Test Professional - Automated Software Testing"
>> group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/MercuryQTP?hl=en
>>
>
> --
> You received this message because you are subscribed to the Google
> "QTP - HP Quick Test Professional - Automated Software Testing"
> group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/MercuryQTP?hl=en
>
--
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en
Call RowCountValidation "RowCount"
Function RowCountValidation(strRowCountFile)
''Initialize Database Objects
Dim adoRecordSet1,adoRecordSet2
Dim adoConnection
Dim adoCommand
Dim conString
conString="Provider=SQLOLEDB.1;Password=1234;Persist Security
Info=True;User ID=sa;Initial Catalog=AdventureWorks;Data Source=SHALABHDIXIT-PC"
'Set Database Objects
Set adoConnection=CreateObject("ADODB.Connection")
Set adoRecordSet1=CreateObject("ADODB.RecordSet")
Set adoRecordSet2=CreateObject("ADODB.RecordSet")
adoConnection.Open(conString)
DataTable.ImportSheet "C:\Test\"&strRowCountFile&".xls","Rowcount","Global"
strFileRowCount=DataTable.GlobalSheet.GetRowCount
MsgBox strFileRowCount
val1 = DataTable.Value("Database1",dtGlobalSheet)
val2= DataTable.Value("Database2",dtGlobalSheet)
Set adoRecordSet1=adoConnection.Execute(val1)
Set adoRecordSet2=adoConnection.Execute(val2)
fieldsCount1=adoRecordSet1.Fields.Count
fieldsCount2=adoRecordSet2.Fields.Count
MsgBox query &"fieldsCount1= " &fieldsCount1 &" fieldsCount2 = "
&fieldsCount2
Do
For i=0 to fieldsCount1-1
Print adoRecordSet1.Fields(i).value &
adoRecordSet1.Fields(i).Name
valueSet1=adoRecordSet1.Fields(i).Value
MsgBox valueSet1
adoRecordSet1.MoveNext
For j=0 to fieldsCount2-1
Print adoRecordSet2.Fields(j).value &
adoRecordSet2.Fields(j).Name
valueSet2=adoRecordSet2.Fields(j).Value
MsgBox valueSet2
If valueSet1=valueSet2 Then
Reporter.ReportEvent micDone, "Data
match success","Database matched successfully"
Else
Reporter.ReportEvent micDone, "Data
match failure","Database NOT matched"
End If
Next
adoRecordSet2.MoveNext
Next
Loop until adoRecordSet1.EOF and adoRecordSet2.EOF
adoConnection.Close
Set adoConnection=nothing
End Function