Ad Home

Theme images by kelvinjay. Powered by Blogger.

Travel

Header Ads

Java

Selenium

UFT

Framework

General QA Concept

BDD

» » 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,
Srinivas

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")


UserName=datatable.value("UserName",Sheetname)

if (Username=UserName) then
msgbox "Pass"
else
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
or
Create description on Link
like
Set o_link=Description.create()
o_link("MicClass").Value="Link"

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
Datatable.ImportSheet"D:\srinu.xls",1,2
rc=Datatable.GetSheet(2).getrowcount
For i= 1 to rc
Datatable.SetCurrentRow(i)
If (RS_Obj.fields.Item("ename") =datatable.value("Ename",2)) then
RS_Obj.Movenext
msgbox "Pass"
else
msgbox "Fail"
end if
Next
'Closing all created and opened objects
Conn_Obj=Close
RS_Obj=Close
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,
http://www.learnqtp.com/how-to-identify-broken-links-in-qtp/
go to this link akur has given a way to find out broken link.Even i learnt from it.

-------------------------------------------------------------------

«
Next
Newer Post
»
Previous
Older Post

No comments:

Leave a Reply