Results 1 to 15 of 15

Thread: Descriptive Programming

  1. #1
    Junior Member
    Join Date
    Apr 2006
    Answers
    1

    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?


  2. #2
    Contributing Member
    Join Date
    May 2006
    Answers
    78

    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?


  3. #3
    Expert Member
    Join Date
    Apr 2006
    Answers
    124

    Re: Descriptive Programming

    No only descriptive programming in QTP will not identify the objects and the test will not run.


  4. #4
    Junior Member
    Join Date
    Oct 2006
    Answers
    1

    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.


  5. #5
    Contributing Member
    Join Date
    May 2006
    Answers
    75

    Re: Descriptive Programming

    Nice discussion going around. Ahuja1234 you are not wrong. You are right in your statement.


  6. #6
    Junior Member
    Join Date
    Oct 2006
    Answers
    10

    Re: Descriptive Programming

    require some more information


  7. #7
    Contributing Member
    Join Date
    Feb 2007
    Answers
    48

    Re: Descriptive Programming

    Hi Ahuja,

    your script is really good

    Regards,
    SM Ganesh

    Last edited by smganesh; 03-21-2007 at 03:33 AM.

  8. #8
    Junior Member
    Join Date
    Apr 2007
    Answers
    8

    Re: Descriptive Programming

    ex: for descriptive programming is
    window("text:=Flight Reservation").winedit("attached text:=Name").set "zyx"


  9. #9
    Contributing Member
    Join Date
    Feb 2007
    Answers
    61

    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


  10. #10
    Expert Member
    Join Date
    Apr 2007
    Answers
    147
    [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 04:59 AM.

  11. #11
    Junior Member
    Join Date
    Sep 2007
    Answers
    3

    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?


  12. #12
    Expert Member
    Join Date
    Nov 2006
    Answers
    518

    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
    ***********

    Last edited by sutnarcha; 07-08-2008 at 08:09 AM.
    Lack of WILL POWER has caused more failure than
    lack of INTELLIGENCE or ABILITY.

    -sutnarcha-

  13. #13
    Junior Member
    Join Date
    Feb 2008
    Answers
    2

    Re: Descriptive Programming

    Hey really good piece of code


  14. #14
    Junior Member
    Join Date
    Jul 2007
    Answers
    2

    Re: Descriptive Programming

    Hi Ahuja,
    Nice descusion is going on..
    Since object repository is empty then how the QTP recognize the object? Please clear on this ...
    Thanks
    Dhananjay


  15. #15

    Re: Descriptive Programming

    Hi Dhananjay,

    In descriptive programming OR will be empty but QTP will identify the objects based on the property and values you provide while writing the code.
    QTP can identify objects from the mandatory properties first....If it fails with mandatory properties then it will check for assistive properties....If it fails for assistive also then it will check for Ordinal properties....and lastly If it fails with ordinal also then it will go for creation Time property(Applicable only for Web Based Applications)......

    Let me know if this cleared your doubt or not?????


  16.  Sponsored Ads
    Ad


     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact