SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 9 of 9
  1. #1
    Senior Member
    Join Date
    Feb 2012
    Location
    India
    Posts
    203
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Is this Generic Function ?

    I have defined Function in Function Library -

    Function LoginActiTime(sUN,sPwd)
    SystemUtil.Run "iexplore.exe","http://127.0.0.1/login.do"
    Browser("actiTIME - Login").Page("actiTIME - Login").WebEdit("username").Set sUN
    Browser("actiTIME - Login").Page("actiTIME - Login").WebEdit("pwd").Set sPwd
    Browser("actiTIME - Login").Page("actiTIME - Login").WebButton("Login now").Click
    End Function

    And accessing it from any Test Script -

    'logging into ActiTIme Application
    '-------------------------------------------------------------------------
    sUN=DataTable("UserName",dtglobalsheet)
    sPwd=Datatable("Pwd",dtglobalsheet)

    Call LoginActiTime(sUN,sPwd)

    Is this example of Generic Function. Can please anyone suggest me, whether I am right or wrong.


    Thanks & Regards,
    Robin Tyagi

  2. #2
    Super Member QAGanesh's Avatar
    Join Date
    Sep 2010
    Posts
    1,898
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Is this Generic Function ?

    I think this is just a function that can be used for login scenario not a generic one.
    Thanks,
    Ganesh Iyer
    Winds of Change

  3. #3
    Senior Member
    Join Date
    Feb 2012
    Location
    India
    Posts
    203
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Is this Generic Function ?

    Ganesh Can you please suggest me that Why it not Generic Function. OR when we can say that a Function is Generic in QTP.


    Thanks & Regards,
    Robin Tyagi

  4. #4
    Super Member QAGanesh's Avatar
    Join Date
    Sep 2010
    Posts
    1,898
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Is this Generic Function ?

    See a generic function is something that can be used across various tests, here in your function you have reference to OR for both Browser & Page. One cannot use this directly across.

    A generic function may b something like ConnectToDatabase(DBAttributes) which has DB attributes to passed as parameters.
    Thanks,
    Ganesh Iyer
    Winds of Change

  5. #5
    Junior Member
    Join Date
    May 2007
    Posts
    15
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Is this Generic Function ?

    Yes Robin, your function cannot be called as Generic function, as rightly said by Ganesh.

    You can call a function as generic when it is independent of the application objects and dynamic in nature, which can be used across any application.

    You can make the same login function as generic one by making the objects as arguments passed to the function instead of defining the object hierarchy within the function.

    Eg., Function Login (obj1,obj2,obj3,UID,PWD)

    obj1 -> UID object reference
    obj2 -> Pwd object reference
    obj3 -> Login button reference.

  6. #6
    Senior Member
    Join Date
    Feb 2012
    Location
    India
    Posts
    203
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Is this Generic Function ?

    Hi Ganesh and Deepa, I want to share you one thing. As Deepa is telling that in Generic Function, For example Login Function, We should pass "objects as arguments passed to the function instead of defining the object hierarchy within the function."

    So In case of Generic Function Don't we use Library for reusability to define it there.

    If 4 application call this function, then four time we will be defining objects and will be passing as arguments. So according to me these objects should be defined in Test Script as per logic.
    Is Generic Function supports the concept of Reusability.


    Thanks & Regards,
    Robin Tyagi

  7. #7
    Senior Member
    Join Date
    Feb 2012
    Location
    India
    Posts
    203
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Is this Generic Function ?

    Means if 2 application are using this Generic Login Function, then -
    obj1 -> UID object reference
    obj2 -> Pwd object reference
    obj3 -> Login button reference

    Should be defined in the 2 Test Script used in 2 different Application. So in this case it should not be reusable. Because perhaps we should not define these objects reference in Library Function for reusability.

    So does Generic function follows Reusability.

  8. #8
    Super Member QAGanesh's Avatar
    Join Date
    Sep 2010
    Posts
    1,898
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Is this Generic Function ?

    Robin u can define a generic function to enter text in webedits, or click webbuttons etc. These can be used across all the tests by just passing object reference
    Thanks,
    Ganesh Iyer
    Winds of Change

  9. #9
    Senior Member
    Join Date
    Feb 2012
    Location
    India
    Posts
    203
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Is this Generic Function ?

    Ganesh Yes I have got You. Please just try to catch what I am trying to say. Suppose we are creating Generic Function for entering information in WebEdit.
    1. Suppose there are 20 Test Script in my application which want to enter information in that same WebEdit.
    2. I create one Generic Function for that.I will require 20 different Object reference as argument.
    3. So 20 object reference should be defined inside of individual 20 Test Scripts.

    Means no use of Library Function in case of Generic Function.
    Am I right ?

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 10.71%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 12:25 PM.

Copyright BetaSoft Inc.