Geeks Talk

Prepare for your Next Interview


Welcome to the Geeks Talk forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Descriptive Programming

This is a discussion on Descriptive Programming within the QTP forums, part of the Software Testing category; Hi, 1.Can anybody give a sample code of Descriptive programming in QTP?(Not Definitions). 2. How can you test a Dynamic moving objects using QTP? If Tested? What is the code ...

Go Back   Geeks Talk > Software Testing > QTP
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read
  #1 (permalink)  
Old 05-14-2006
Junior Member
 
Join Date: Apr 2006
Posts: 1
Thanks: 0
Thanked 1 Time in 1 Post
thotaravikiran is on a distinguished road
Descriptive Programming

Hi,

1.Can anybody give a sample code of Descriptive programming in QTP?(Not Definitions).

2. How can you test a Dynamic moving objects using QTP? If Tested? What is the code for that?
Reply With Quote
The Following User Says Thank You to thotaravikiran For This Useful Post:
Sponsored Links
  #2 (permalink)  
Old 06-01-2006
Contributing Member
 
Join Date: May 2006
Location: Hyderabad, India
Posts: 81
Thanks: 4
Thanked 13 Times in 11 Posts
bharathi_ark is on a distinguished road
Re: Descriptive Programming

If we do only Descriptive programming in QTP without recoding, will the objects be identified in Object Repository and will the test run execute?
Reply With Quote
  #3 (permalink)  
Old 06-07-2006
Expert Member
 
Join Date: Apr 2006
Location: India, Hyderabad
Posts: 133
Thanks: 21
Thanked 48 Times in 18 Posts
bvani will become famous soon enough
Re: Descriptive Programming

No only descriptive programming in QTP will not identify the objects and the test will not run.
Reply With Quote
  #4 (permalink)  
Old 10-11-2006
Junior Member
 
Join Date: Oct 2006
Posts: 1
Thanks: 0
Thanked 3 Times in 1 Post
ahuja1234 is on a distinguished road
Re: Descriptive Programming

You can write a QTP script using descriptive programming without recording.
You can use object spy to specify the object's properties so that it can be identified.
Note that the object repository is empty in this case but the script runs fine.
For example, following is the code I wrote to check this out.
It just searches for some string on google.
This runs the first time without any recording:

===========

Dim GBrowser : Set GBrowser=Browser("name:=Google.*")
Dim GPage : Set GPage=GBrowser.Page("title:=Google.*")
URL="http://www.google.com"
SystemUtil.run "iexplore",URL
GPage.WebEdit("name:=q","type:=text","html tag:=INPUT").Set "qtp"
GPage.WebButton("name:=Google Search","index:=0","type:=submit","html tag:=INPUT").Click
=====================

Please let me know if I am wrong.

Thanks.
Reply With Quote
The Following 3 Users Say Thank You to ahuja1234 For This Useful Post:
  #5 (permalink)  
Old 10-13-2006
Contributing Member
 
Join Date: May 2006
Posts: 76
Thanks: 0
Thanked 6 Times in 5 Posts
blenda is on a distinguished road
Re: Descriptive Programming

Nice discussion going around. Ahuja1234 you are not wrong. You are right in your statement.
Reply With Quote
  #6 (permalink)  
Old 10-29-2006
Junior Member
 
Join Date: Oct 2006
Location: hyderabad
Posts: 12
Thanks: 1
Thanked 0 Times in 0 Posts
yagnkan is on a distinguished road
Re: Descriptive Programming

require some more information
Reply With Quote
  #7 (permalink)  
Old 02-20-2007
Contributing Member
 
Join Date: Feb 2007
Location: Delhi
Posts: 51
Thanks: 3
Thanked 12 Times in 6 Posts
smganesh is on a distinguished road
Re: Descriptive Programming

Hi Ahuja,

your script is really good

Regards,
SM Ganesh

Last edited by smganesh; 03-21-2007 at 04:33 AM.
Reply With Quote
  #8 (permalink)  
Old 04-08-2007
Junior Member
 
Join Date: Apr 2007
Location: bangalore
Posts: 8
Thanks: 0
Thanked 1 Time in 1 Post
sksanath is on a distinguished road
Re: Descriptive Programming

ex: for descriptive programming is
window("text:=Flight Reservation").winedit("attached text:=Name").set "zyx"
Reply With Quote
  #9 (permalink)  
Old 04-09-2007
Contributing Member
 
Join Date: Feb 2007
Location: Madras
Posts: 72
Thanks: 11
Thanked 7 Times in 7 Posts
raghav.kamal is on a distinguished road
Re: Descriptive Programming

Hey guys first of all be aware of onething, For Descriptive programming Object repository is not required ..There is nothing to do with Object Repository if we are doing scripting descriptively..
Like our friends said in the above posts, We can use n number of attributes for scripting descriptively
Reply With Quote
  #10 (permalink)  
Old 04-18-2007
Expert Member
 
Join Date: Apr 2007
Location: Kolkata
Posts: 151
Thanks: 3
Thanked 11 Times in 10 Posts
debleena23 is on a distinguished road
[QUOTE=thotaravikiran;20] 1.Can anybody give a sample code of Descriptive programming in QTP?(Not Definitions).
QUOTE]
EG...
Browser("BrowserName").Page("PageName").WebEdit("name:=Login","index:=0").Set "John"
Here, "name" is one general property and "index" is the unique property

Quote:
Originally Posted by thotaravikiran View Post
2. How can you test a Dynamic moving objects using QTP? If Tested? What is the code for that?
For this kind of scenario use Regular Expression

Quote:
Originally Posted by bharathi_ark View Post
If we do only Descriptive programming in QTP without recoding, will the objects be identified in Object Repository and will the test run execute?
YES, It will run

Quote:
Originally Posted by ahuja1234 View Post

===========

Dim GBrowser : Set GBrowser=Browser("name:=Google.*")
Dim GPage : Set GPage=GBrowser.Page("title:=Google.*")
URL="http://www.google.com"
SystemUtil.run "iexplore",URL
GPage.WebEdit("name:=q","type:=text","html tag:=INPUT").Set "qtp"
GPage.WebButton("name:=Google Search","index:=0","type:=submit","html tag:=INPUT").Click
=====================

Please let me know if I am wrong.

Thanks.
Hi Ahuja
This is really is good piece of code
even we practice something like this

Last edited by jainbrijesh; 05-19-2007 at 05:59 AM.
Reply With Quote
  #11 (permalink)  
Old 10-06-2007
Junior Member
 
Join Date: Sep 2007
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
yechuri is on a distinguished road
Re: Descriptive Programming

[QUOTE=debleena23;10567]
Quote:
Originally Posted by thotaravikiran View Post
1.Can anybody give a sample code of Descriptive programming in QTP?(Not Definitions).
QUOTE]
EG...
Browser("BrowserName").Page("PageName").WebEdit("name:=Login","index:=0").Set "John"
Here, "name" is one general property and "index" is the unique property



For this kind of scenario use Regular Expression



YES, It will run



Hi Ahuja
This is really is good piece of code
even we practice something like this
Hi ahuja,can we write descrptive program without using spy.?here u declared
dim,why?can u explain me pls?
Reply With Quote
  #12 (permalink)  
Old 07-08-2008
Expert Member
 
Join Date: Nov 2006
Location: Hyd-IND
Posts: 528
Thanks: 1
Thanked 63 Times in 50 Posts
sutnarcha is on a distinguished road
Re: Descriptive Programming

I must say... this is a smart piece of code from Ahuja.

We use Object Spy to get the properties and their values to uniquely identify the objects in the application. If we know such properties and their unique values that can identify the required object without ambiguity, we need not use Object Spy.

Instead of using --Browser("name:=Google.*")-- in the code each time we want to refer to the browser, we can set it as an object by declaring a variable with Dim statement. Now, the variable can be used as a shortcut for all references to the browser window and the web page.

The above program can be written using "With" statement where we don't have to declare the variables using Dim.

***********
With Browser("name:=Google.*").Page("title:=Google.*")
URL="http://www.google.com"
SystemUtil.run "iexplore",URL
.WebEdit("name:=q","type:=text","html tag:=INPUT").Set "qtp"
.WebButton("name:=Google Search","index:=0","type:=submit","html tag:=INPUT").Click
End With
***********
__________________
Lack of WILL POWER has caused more failure than
lack of INTELLIGENCE or ABILITY.

-sutnarcha-

Last edited by sutnarcha; 07-08-2008 at 09:09 AM.
Reply With Quote
  #13 (permalink)  
Old 09-02-2009
Junior Member
 
Join Date: Feb 2008
Location: Bangalore
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
subbumba is on a distinguished road
Re: Descriptive Programming

Hey really good piece of code
Reply With Quote
Reply

  Geeks Talk > Software Testing > QTP

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
C Programming - Linked Lists Lokesh M C and C++ 1 03-05-2007 07:02 AM
C Programming - File management in C Lokesh M C and C++ 0 05-31-2006 04:35 PM
C Programming - Dynamic Memory allocation Lokesh M C and C++ 0 05-29-2006 03:35 AM
C Programming - Structures and Unions Lokesh M C and C++ 0 05-26-2006 02:06 AM
C Programming - Pointers Lokesh M C and C++ 0 05-26-2006 02:05 AM


All times are GMT -4. The time now is 06:02 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved