Skip to Content

Story: Recently I was busy with writing some HP LoadRunner scripts for WebUI. Having no practical experience and being actually a dummy in HP LR in general, I trained myself based on the multiple videos available on YouTube. However, when doing scripts for WebUI I experienced some problems, which are not described well enough somewhere. Therefore, I decided to share my experience here…

1.    Manual Correlation

A first thing what you need to do with your script, you need to correlate your script parameters. This means that we need to identify the source for the values and using this source we need to populate our variables.

The process of identifying a proper source for the variable looks like described below.

For instance, you noticed down you are missing a variable REF_ID at line 114. Variable HOST is a defined constant.

/wp-content/uploads/2016/05/p1_956402.png

We can assume that the variable is coming from the previously executed request or requests. First you need to step over the previously executed request, at the line 77. Then select a tab “Snapshot” – “Recording”. Next, navigate to “Response” area and click CTRL+F.

/wp-content/uploads/2016/05/p2_956404.png

Copy the value (e.g. bD1lbiZjPTEwMCZkPW1pbg==) from your Excel file and search for all the occurrences of it.

/wp-content/uploads/2016/05/p3_956405.png

Double-click on the first occurrence in the list.

/wp-content/uploads/2016/05/p4_956406.png

You are navigated to the place of occurrence.

/wp-content/uploads/2016/05/p5_956407.png

What do we get from this? It was a redirected GET request, data is located in the response header, within the following line: location: /sap(bD1lbiZjPTEwMCZkPW1pbg==)/bc/bsp/sap/crm_ui_start/default.htm?sap-sessioncmd=open , in between: “()”. And it’s already enough to get this data in runtime, by using the function web_reg_save_param_ex.

We need to place the following code into the lines right BEFORE our request. So lines 59 – 74 should look like below.

   
      /*    Correlation   comment – Do not change! 
          Original   value=’bD1lbiZjPTEwMCZkPW1pbg==’
          Name   =’REF_ID’
          Type   =’ResponseBased
          Response   Header: location:   /sap(bD1lbiZjPTEwMCZkPW1pbg==)/bc/bsp/sap/crm_ui_start/default.htm?sap-sessioncmd=open
       */   
      web_reg_save_param_ex(
          ParamName=REF_ID,
          LB=sap(,
          RB=)/,
          Notfound=warning,
          SEARCH_FILTERS,
          Scope=Headers,
          IgnoreRedirections=No,
          RequestUrl=*/crm_ui_start/default.htm*,
          LAST);

You can find more details regarding this function here: http://lrhelp.saas.hp.com/en/latest/help/function_reference/Content/web/lrFr_web_reg_save_param_ex.htm

Similar procedures must be performedfor all the variables you defined.

We will consider some common cases that can be relevant for all WebUI HP LR Scripts.

1.1.                    Getting Referrer ID

Referrer ID is required across complete script, from the login page until log-out.

    /*    Correlation comment – Do not   change! 
          Original value=’bD1lbiZjPTEwMCZkPW1pbg==’
 
        Name =’REF_ID’
 
        Type =’ResponseBased
 
        Response Header:   location:   /sap(bD1lbiZjPTEwMCZkPW1pbg==)/bc/bsp/sap/crm_ui_start/default.htm?sap-sessioncmd=open
 
     */   
     
web_reg_save_param_ex(
         
ParamName=REF_ID,
         
LB=sap(,
         
RB=)/,
         
Notfound=warning,
         
SEARCH_FILTERS,
         
Scope=Headers,
         
IgnoreRedirections=No,
         
RequestUrl=*/crm_ui_start/default.htm*,
         
LAST);
 
     
     
web_custom_request(“default.htm_2”,
         
URL={HOST}/sap/bc/bsp/sap/crm_ui_start/default.htm?sap-sessioncmd=open,
         
Method=POST,
         
….

1.2.                    Getting Session ID

Session ID is required across complete script, from the login page untillog-out.

    /*    Correlation comment – Do not   change! 
          Original   value=’ZT1VMGhCVWxOSVFWUkxTVTVmTXpGZk1UYzJBRkJXbGhZOEh1YUdvTWo2N3Q4QWhRPT0=’
          Name   =’ESID’ Type =’ResponseBased
       */
      web_reg_save_param_ex(
          ParamName=ESID,
          LB=(,

        RB=),
          Notfound=error,
          SEARCH_FILTERS,
          Scope=Body,
          LAST);
 
 
      web_submit_data(uif_callback,
          Action={HOST}/sap/webcuif/uif_callback?sap-client=100&sap-language=EN&sap-domainRelax=min&crm_handler=CL_CRM_UI_SESSION_MANAGER,
          Method=POST,
          RecContentType=text/plain,
          Referer={HOST}/sap({REF_ID})/bc/bsp/sap/crm_ui_start/default.htm,
          Snapshot=t7.inf,
          Mode=HTML,
          ITEMDATA,
          Name=cmd, Value=get_esid, ENDITEM,
          LAST);

1.3.                    Getting WCF Request Ticket

WCF Request Ticket is required across complete script, from the login page until log-out.

/*    Correlation   comment – Do not change! 
      Original   value=’AF5073FD82AC118ADB0067CA7B4E52A7′
      Name   =’WCF_REQUEST_TICKET’
      Type =’ResponseBased
  */
      web_reg_save_param_ex(
          ParamName=WCF_REQUEST_TICKET,
           LB=name\=\”wcf-secure-id\”   value\=\””,
          RB=\””,
          Notfound=error,
          Ordinal=LAST,
          SEARCH_FILTERS,
          Scope=Body,
          LAST);

    web_url(“main.htm”,
          URL={HOST}/sap({ESID})/bc/bsp/sap/crm_ui_frame/main.htm?sap-client=100&sap-language=EN&sap-domainRelax=min&saprole=SALESPRO,
          Resource=0,

Hint: Symbol \ (back-slash) before the character means that this character should be considered as part of the text string, and not as a “special character”.

Hint: Sometimes you get several values for the same criteria. Therefore while testing and debugging you can set up Ordinal=All to get a clear vision on which value you need. In this case, we wanted the LAST occurrence only.

1.4.                    Getting Referrer ID (2)

Referrer ID is required across complete script, from the login page until log-out.

/*    Correlation   comment – Do not change! 
      Original value=’bD1FTiZjPTEwMCZpPTEmZT1VMGhCVWxOSVFWUkxTVTVmTXpGZk1UYzJBRkJXbGhZOEh1YUdvTWo2N3Q4QWhRJTNkJTNk’
      Name =’REF_ID_2′
      Type =’ResponseBased
      Response Header: location: var thtmlbMangling =   “bD1FTiZjPTEwMCZpPTEmZT1VMGhCVWxOSVFWUkxTVTVmTXpGZk1UYzJBRkJXbGhZOEh1YUdvTWo2N3Q4QWhRJTNkJTNk”;
  */
      web_reg_save_param_ex(
          ParamName=REF_ID_2,
          LB=var thtmlbMangling \= \””,
          RB=\”;”,
          Ordinal=LAST,
          SEARCH_FILTERS,
          Scope=Body,
          LAST);

    web_url(“main.htm”,
          URL={HOST}/sap({ESID})/bc/bsp/sap/crm_ui_frame/main.htm?sap-client=100&sap-language=EN&sap-domainRelax=min&saprole=SALESPRO,
          Resource=0,

Hint: Sometimes you get several values for the same criteria. Therefore while testing and debugging you can set up Ordinal=All to get a clear vision on which value you need. In this case, we wanted the LAST occurrence only.

1.5.                    Getting WCF Request Ticket (2)

Referrer ID is required across complete script, from the login page until log-out.

    /*     Correlation comment – Do   not change! 
           Original   value=’09AFA03946E7BD32CD3109628855703D’
          Name   =’WCF_REQUEST_TICKET_6′
          Type   =’ResponseBased

  */
      web_reg_save_param_ex(
          ParamName=WCF_REQUEST_TICKET_6,
          LB=wcf-request-ticket\=”,
          RB=\r\n”,
          SEARCH_FILTERS,
          Scope=Headers,
          RequestUrl=*/bspwdapplication.do*,
          LAST);

Hint: Symbols “\r\n” from the above script mean NEW LINE.

1.6.                    Adding Thinking Time

Often you need to add thinking time in seconds into your script. It can be done using the command lr_think_time()as shown below.

    lr_think_time(5);

You can also influence thinking time by respective runtime settings of your script.

/wp-content/uploads/2016/05/p6_956411.png

2.    Hints

When you test your script you will probably get several errors when processing a logon step or at the very beginning of your script. Next possible issues are related to processing of the popups, especially when they are appearing sequentially one after another. In this case you may not even get any errors in VUGen, but the script execution won’t be successful. This chapter will describe some known cases and the ways to overcome the issues.

The following table contains some common errors and solutions.

         
Error Reason Solution

HTTP Status Code 400

(Session Timed-Out)


Most probably, your session id ESID or referrer session id REF_ID(n) are not correct. Check the correlation of ESID and REF_ID parameters. See hint 5.

HTTP Status Code 403

(Unauthorized Request)


Most probably, your wcf-request-ticket is   not correct. Check correlation of WCF_REQUEST_TICKET(n)   parameter. See hints 5 and 6.

VUGen does not give you any error, but popups are not working.


Most probably you have problems with wcf-request-ticket   or referrer session id REF_ID(n).


Check the correlation of REF_ID(n) and   WCF_REQUEST_TICKET(n). See hints 5, 6, 7 and 8.


Hint 1: Always back-up your script.

Hint 2: Never displace the parameters you cannot correlate by other parameters that you think you correlated correctly.

Hint 3: Try to correlate all parameters. If not possible, try to use constants.

Hint 4: Snapshots can be truncated. Use HTTP tracers instead.

Hint 5: Sometimes in VUGen you get several parameters, even though you can see only one in the Snapshot or in HTTPWatch. In this case use option Ordinal = All to get all the variables (VAR_n) and chose the appropriate one later: Ordinal = 1, 2, N, or LAST.

Hint 6: If the right border (parameter RB) for certain variable is NEXT LINE, you need to use “RB=\r\n” in respective web_reg_save_param_ex call.

Hint 7: VUGen does not give you any error, but popups are not working. You should pay attention to referrer ids and wcf-request-tickets, especially for callbackFlashIslands and callbackSilverlightIslands.

Action={HOST}/sap({REF_ID_2})/bc/bsp/sap/crm_ui_frame/bspwdapplication.do?id=1&wcf-request-ticket={WCF_REQUEST_TICKET_6},

Name=wcf-secure-id, Value={WCF_REQUEST_TICKET}, ENDITEM,

Name=callbackFlashIslands, Value=/sap({REF_ID_2})/webcuif/uif_callback?crm_handler=CL_THTMLBX_FLASH_ISLAND&wcf-request-ticket={WCF_REQUEST_TICKET}, ENDITEM,
          Name=callbackSilverlightIslands, Value=/sap({REF_ID_2})/webcuif/uif_callback?crm_handler=CL_THTMLBX_SILVERLIGHT_ISLAND&wcf-request-ticket={WCF_REQUEST_TICKET}, ENDITEM,
         

Most probably your have displaced the variables manually (see Hint 2.), or simply the performed correlation does not work (Hints 5 and 6).

Hint 8: For the above (Hint 7) described scenario, you could probably see */logon_error.html call within statistical records, transaction STAD.

Hint 9: Always include logoff and browser closure steps into the script.

Hint 10: To identify if your script is executed successfully or not, do not rely on VUGen. Define functional exit criteria and check them on the back-end. For instance if you create 1Order documents, check if they are being created in the table CRMD_ORDERADM_H.

/wp-content/uploads/2016/05/p7_956412.png

P.S. If you have some interesting case, issue or error, feel free to add it here.

BR, Dima

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply