User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 2 of 2
  1. #1
    Senior Member
    Join Date
    Feb 2003
    Post Thanks / Like
    0 Post(s)
    0 Thread(s)
    Total Downloaded

    Generic function for validating a user interface

    More often in your app you have the user interface screen. The user interface displays data input fields and then a control object, most of the times a button to press. Say for example the interface has 10 data input fields of which say 6 are text field where the user needs to type some string text value, 2 are drop down list from which the user selects a value and 2 are radio button of which user makes the box check on. This is just an example but in real world usually app has interface screen that can have the standard control types. WINRUNNER does provide an exclusive command for each control type i.e. text filed has edit_set; drop down list has list_select_tem; radio button has button_set etc.. In this case WEB add-in is loaded.
    Usually for each interface we make standard validation verifications. Some standards are listed below
    - Leaving the field blank and then pressing the submit button. The interface displays a validation message if the field in question is mandatory.
    - Sometimes have all mandatory fields filled and then validating one particular field for correct data type. Say in our case all 9 fields are entered and one text field accepts only numeric. So validate alpha or alpha numeric values are not accepted and correct message is displayed.
    The proposed function is generic and can be used for validating multiple interfaces without much coding.
    First the logic
    - First learn all fields on the interface and have them in your GUI map file
    - Second define a single dimensional array that stores the field names (logical names) and the associated WR command syntax. Say if the field is text field the associated WR command syntax is edit_set. The 2 info bits are separated by character ;. Name your array based on interface name
    E.g. static array_BP_addpayee[] ={"AddModifyPayee_txtPayeeName;edit_set",
    The array elements are stored based on the interface tab order. Usually if user leaves 1st field blank and press submit button the message is displayed with respect to 1st field in tab order and so on.
    Now the actual function code. I am putting the comments after most of the line code to explain the logic.

    public function funcform_validate(in str_productundertest,str_processundertest,str_subp rocess,str_buttonpress,arr_fieldname,str_inputdata filepath)
    <COMMENT> Parameters 1st 3 I have included for my purpose. You can have them changed. 4th is the array that we have defined above. 5th is the associated WR syntax with the submit button that is finally pressed, in our case button_press. 5th is the path where you may have created our excel sheet from where data input is stored for each field on your interface.
    auto str_text,str_fieldname,str_fldcontroltype,int_arre lement,i;

    switch (str_productundertest)
    case "BILLPAYER":

    for (i in arr_fieldname)
    bool_execution = BOOL_PASSED;
    int_arrelement = split (array_BP_addpayee[i], arr_temp, ";");
    <COMMENT> The above line code splits the array element value in 2 parts. 1st part is the field name or the logical name in out GUI map file. 2nd part is the associated WR syntax.

    str_fieldname = arr_temp[1];
    str_fldcontroltype = arr_temp[2];
    switch (str_fldcontroltype)
    case "edit_set":
    # edit_set(arr_fieldname[i],ddt_val(str_inputdatafilepath, str_fieldname) );
    edit_set(arr_fieldname[i],"" );
    case "list_select_item":
    # list_select_item(arr_fieldname[i],ddt_val(str_inputdatafilepath, str_fieldname));
    case "button_set":
    <COMMENT> the above switch command executes the WR command based on the control type of the field that is under test.
    <COMMENT> the above code executes the button press for SUBMIT button or whatever the logical name in our GUI map file
    if (obj_exists("Microsoft Internet Explorer") == E_OK)
    set_window("Microsoft Internet Explorer");
    if (funccheck_text("Microsoft Internet Explorer",str_text,"data_verify","NONE","NONE","NO NE",0,0,0) != E_EXIST)
    bool_execution = BOOL_FAILED;
    tl_step(str_ProcessUnderTest "ValidationStep", 1, arr_fieldname[i] " field input data validation failed");

    <COMMENT> the above code uses another function that I have not posted up here. The purpose is to validate the message displayed on the IE child window. In some cases not necessarily an IE window, may be the message is displayed at the bottom of the screen or something else. So make the changes accordingly.

    if (bool_execution == BOOL_PASSED)
    tl_step(str_ProcessUnderTest "UCStep", 0, str_subprocess " Form Page validation successfully verified");
    tl_step(str_ProcessUnderTest "UCStep", 1, str_subprocess " Form Page validation failed");

    USAGE of the proposed function

    table="C:\ESERCQA_WINRUNNER\Internet Suite\\" & strServicePack & "\EDocuments\EDocumentsControlScript\EDocuments.xl s"; #stores data file path
    funcform_validate("BILLPAYER",strProcessUnderTest, "ADD PAYEE","Add Payee",arrBILLPAYER_addpayee,table);

    PLEASE SHARE THOUGHTS ABOUT THE FUNTION. May be could make it more generic and robust.


  2. #2
    Senior Member
    Join Date
    Jul 2001
    Post Thanks / Like
    0 Post(s)
    0 Thread(s)
    Total Downloaded

    Re: Generic function for validating a user interface

    How about putting the information in array_BP_addpayee[] into a spreadsheet also... it would then be easier to change and extend.

    While you are doing that, you could setup a matrix of field vs validation checks, to make it simpler and more visual to plan which validation checks to do on which fields.

    <font face=courier>
    Field Mandatory Blank Numeric FunnyChars
    Name X X X
    Attn X X
    Address X X
    Zip X X X X

    [This message has been edited by misha_v (edited 03-16-2003).]



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 11.11%
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 11:43 PM.

Copyright BetaSoft Inc.