Find HTML Editor in QTP

December 7th, 2009 by mehul.brahmbhatt § 3

Follow below steps to read and write contents from an HTML Editor if you are testing using QTP

Step 1: QTP by default can not find an HTML Editor so you have to add HTML Editor in object repository. It will add HTML Editor as a frame.

See below image for an example

HTML Editor

Step 2:  Below is an example of how to write contents in an HTML Editor. Write below line once you have added HTML Editor as an object.

Browser(“NewRelease”).Page(“Registration”).Frame(“Frame_2″).Object.write “Testing of add news page.”

Step 3: Below is an example of how to read contents from an HTML Editor.

fName = browser(” New Release”).Page(“ Registration “).Frame(“Frame_2″).WebElement(“testing”).Object.innerText

How to perform stress testing in QTP

August 13th, 2009 by mehul.brahmbhatt § 0

1. Record the script which you want to perform for stress testing.

For Example:  if you want to add 1000 records then just record add functionality  script.

2. Now just add a loop for that script which contains add record functionality. See below example

For i=0 to 1000

Put your add record script code here. It will repeat the add record loop till 1000 entries will be done.You can insert  1000 records using For.. Next loop.You can also insert more than 1000 or more.Just change your for loop condition for that.

Next will increase your loop counter

Next

Below code is a full example of the stress testing:

For i=0 to 1000

Below code will insert first name jigar. For unique name you can pass value of  i so it will insert unique name each time.

Browser(“PMS”).Page(“PMS_3″).WebEdit(“txt_Name”).Set “Jigar” & i

Below code will enter address in the address field.

Browser(“PMS”).Page(“PMS_3″).WebEdit(“txt_Address”).Set “Surat”

Below code will enter mobile number  in the mobile number field.

Browser(“PMS”).Page(“PMS_3″).WebEdit(“txt_No”).Set “9992426690″

Below is code to save the details

Browser(“PMS”).Page(“PMS_3″).Link(“btn_save”).Click

Next

This is a script to add 1000 records.

Database Connection in QTP

July 21st, 2009 by jigar.parvatia § 0

How to connect database with application running in QTP to check data in DB dynamically?

An example is shown connecting QTP with SQL Server

A simple script is shown below with necessary comments :

Dim con,rs,column_count,column_name,i,column_value

Set con=createobject(“adodb.connection”) // Its a connection object
Set rs=createobject(“adodb.recordset”) // A record set should be defined

// Necessary connection string should be their
con.open “provider=sqloledb.1;server=.\SQLEXPRESS;database=DBNAME;user id=XYZ;password=XYZ”

// Finally the record set is defined to fetch the value of particular fields according to the query passed.

rs.open”select * from tbl_newsMaster where username=’admin’”

// Checks the record set till the end until any record is found.If any record is found then it stores the values in “rs” record set.
Do while not rs.eof
For i = 0 To rs.Fields.Count -1
‘ msgbox rs.Fields.Count //counts the number of records in record set “rs”
column_value=rs.Fields(i).value //Fetches the value of particular field stored in record set “rs”
column_name=rs.Fields(i).name
Msgbox “Record Exist :” & column_name&” ” &column_value
next
rs.movenext
Loop

Where Am I?

You are currently browsing entries tagged with QTP at Digicorp.