Header Ads

Srinivas's page...

Dear Animesh,

This is Srinivas. I have seen your blog.(askqtp.blogspot.com) It is very useful for automation testers and informative.

I am looking for a job on Automation testing. I have some questions on QTP.

Question 1: How to compare input values against Database values?

(I have entered data into one form in the front-end application.I have to check the data has been stored correctly in back-end database using automation script ? Could you please give the solution for this?)

Question 2: How can i count broken links and working links in a Web page?

I will post other questions also.

Thanks in Advance.

With Regards,

ok let me start with database connection

set conn=Createobject("ADODB.Connection")
Servname="Driver={Microsoft ODBC for Oracle}:Server=DBserver,UID=your ID,Password=Your Password"
conn.open Servname
Set Rec = CreateObject("ADODB.Recordset")
SQL="select * from Users"
Rec.open SQL ,conn
Username=Rec.fields("employee name")


if (Username=UserName) then
msgbox "Pass"
msgbox "Fail"

end if

2.There is a good option for testing broken link..

2.1 Open "Linkchecker.com"
2.2 Give URL name there
2.3 Press Submit

This will give you list of broken links.

Automate this through QTP
Create description on Link
Set o_link=Description.create()

now find this o_link in the entire page and click on them.
Now set a checkpoint if the page openning gives the "Page Not found" error then it is a broken link.

Hi Animesh,

Thanks for your quick reply. I have used the logic which you have given in the blog. Here my question is how to compare multiple columns at a time. (Suppose there are 50 Columns in the database table). I am giving the below code which I have implemented.

Function DBC(Query)
'Creating Variables
Dim Conn_Obj, RS_Obj
'Creating Database Object
Set Conn_Obj=CreateObject("ADODB.CONNECTION")
'Creating Record set Object
Set RS_Obj=CreateObject("ADODB.RECORDSET")
'Opening Connection Object
Conn_Obj.Open "Driver=Oracle in XE;UID=srinug;PWD=srinug"
'Opening Record set Obj
RS_Obj.Open Query ,Conn_Obj
For i= 1 to rc
If (RS_Obj.fields.Item("ename") =datatable.value("Ename",2)) then
msgbox "Pass"
msgbox "Fail"
end if
'Closing all created and opened objects
Set Conn_Obj=Nothing
Set RS_Obj=Nothing
End Function
'Calling Database connection function and passing values in to the function
Call DBC("select * from emp")

I am attaching the excel sheet (used in the above code) for your reference.

Fantastic code sir...I really like it.Let me look into this.
Hi Srini,
go to this link akur has given a way to find out broken link.Even i learnt from it.

Powered by Blogger.