HPE Software Products: Best Practices and Methodology
Share |

How To More Accurately Measure Window Response Using the MercuryTimers API and Custom FunctionsOpen in a New Window

A major challenge of performance testing is measuring the response time navigating through screens on the Application under Test (AUT).  Response is important in performance testing because it represents how long a user must wait after doing something on the system.  Hewlett Packard Enterprise LoadRunner load testing software measures transaction response time at the Application Program Interface (API) level.  The LoadRunner transaction response measurements comprise the following system latency:

Response.png

 

  • Average processing time on the Web Server
  • Average processing time on the Application Server
  • Average processing time on the Database Server
  • Network latency between the servers, and the client

 However, there is additional latency involved processing a transaction on the user interface. For example, the processing time it takes for a web page to fully load on the client.  Ignoring this additional system latency can give an inaccurate picture of the actual system performance users might experience.  Failure to accurately document and replicate the actual transaction response can lead to significant problematic issues which hinder the successful development and delivery of a complex IT system.

This blog overviews the best practices for leveraging the Unified Functional Testing (UFT) automated testing tool in performance testing to measure transaction response at the User Interface (UI) level.

HPE UFT is integrated with HPE LoadRunner.

To implement these capabilities in HPE UFT:

Define Environment Variables:  PAGE_RESP_REQ, PAGE_LOAD_WAIT

Environment variables in UFT are similar to that of Global Variables when compared to traditional programming languages like “C:”

Syntax: 

Environment(“EnvironmentVariableName”) = “Value”

 There are two types of Environment variables:

  • External
  • Internal

Environment VariablesEnvironment VariablesExternal Environment variables are loaded from an external ini or xml file.  Since  the PAGE_RESP_REQ internal variables as the pass/fail requirement.  The variable is used in a conditional "if...Then...Else" statement.  If the web page response time is greater than the PAGE_RESP_REQ variable, the UFT tool will log a fail.  If the web page response time display is less than the PAGE_RESP_REQ variable, the UFT tool will log a pass.

Below is an example of the predefined PAGE_RESP_REQ variable in UFT:

Msgbox = Environment.Value ("PAGE_RESP_REQ"). 

The PAGE_LOAD_WAIT variable is leveraged in the  procedure to indicate how long UFT will wait for the web page to display before timing out. Below is an example of the predefined PAGE_LOAD_WAIT variable in UFT: 

Msgbox = Environment.Value ("PAGE_LOAD_WAIT"). 

 

Create functions to measure window response

 A UFT function is a set of code that is useful to perform important tasks and repeat those task multiple times. The function is written when there are no available UFT methods to accomplish the tasks

CUSTOM FUNCTION:  Invoke_Check_Exit

  • Invoke the window
  • Check the window
  • Close the window
'####################################################################################
'#  Public Function InvokeCheckExit ( sLink, s_WElem )                                        
'#                  ===================================
'#  DESCRIPTION:
'#  This is a business function that invokes a window, starts a transaction timer, waits for the window 
'#  to display, verifies an expected web element on the window,  and returns a response time, 
'#
'# 1.  Clicks a Web Link
'# 2.  Starts a Transaction Timer
'# 3.  Waits until the requested window is displayed and stops the timer
'# 4.  Returns the Response Time
'#
'# Input Variables:
'#    [In] sLink - Name of the window object to display
'#    [In] s_WElem -  Recognition object of the window
'#
'# RETURNS:  
'#     [Out] The window response time in seconds
'#
'# SAMPLE CALL:  rc = InvokeCheckExit( "Catalog", "Total Qty" )
'#
'####################################################################################
Public Function InvokeCheckExit ( sLink, s_WElem ) 

    On Error Resume Next  'Enables Error handling
    Const sFunction = "InvokeCheckExit"
        Call  ClickWebLink( sLink ) 'Clicks a Web link using a descriptive program routine
        rsStopTime = WaitForWin (s_WElem)/1000  'waits for window to display
        
        If Err <> 0 Then
            <<Insert your own error routine>>
        End If    
        
        On Error GoTo 0  'Disables error handing 
        
     InvokeCheckExit = rsStopTime

End Function

CUSTOM FUNCTION: WaitForWin

  • Starts the Mercury Timer (Method Start)

The Mercury Timers object enables measurement of time between any two operations and allows the utilization of multiple timer_name time measurement transactions in parallel.  The timer objects are stored with a unique key and are useful for measuring the time elapsed and different levels of the run session.

Syntax:  MercuryTimers("MyTimer").Start

  •  Check the Web page

Utilizing descriptive programming, the function creates a web element object dynamically during run time.

Descriptive Programming provides a method to define objects, which are not present in the UFT object repository, programatically.  The objects are created dynamically at script run time.

Descriptive Programming is useful when the object properties in AUT are dynamic in nature and need special handling to identify the object, for example, clicking a Web Link which changes according to the user role.

The function leverages the UFT exist method to check if the web element exists.  The code is in a loop and continues to check for the web element until the Mercury Timer exceeds the internal PAGE_LOAD_WAIT environment variable set in UFT.  If the object exists in the open application web page displayed, the “Do Loop” is exited.

Syntax:  object.Exist ([TimeOut])     

Synchronization SettingSynchronization Setting[TimeOut] Optional paramenter, which is the length of time (in seconds) to search for the object before returning a True of False Value.  If a timeout value is specified, UFT waits until it finds the object before returning a True or False value.

If no value is specified, the value specified in the Test Settings dialog box for the Object Synchronization Timeout is used for the test.  The pre-defined default is 20 seconds.

 

 

 

 

 

 

  • Stop the Mercury Timer (Method Stop)

Syntax:  MercuryTimers("MyTimer").Stop                          

  • Calculate Elapsed Time (Method ElapsedTime)

Syntax:  MercuryTimers("MyTimer").ElapsedTime

 

'############################################################
'#  Public Function WaitForWin (sNewPage)                                       
'#                  =====================
'#  DESCRIPTION:
'#  This is a business function that waitS for a window to display for a period of 
'#  time no longer than an environment value defined in UFT
'# Input Variables:
'#    [In] sNewPage - The Value of a web element on the browser page
'# RETURNS:  
'#     [Out] The window response time in milli seconds
'# SAMPLE CALL: rsStopTime = WaitForWin (s_WElem)
'############################################################
Public Function WaitForWin_Wavemark (sNewPage)     
    On Error Resume Next
    Set oPage = Browser("micclass:=Browser").Page("micclass:=Page")
    ' Start a new timer
    MercuryTimers(sNewPage).Start
    bPageExists = FALSE
    ' Loop for up to PageLoadWait seconds waiting for a page to load.  If not loaded within this time, assume an error.
    Do Until cint (MercuryTimers(sNewPage).elapsedTime/1000) > cint (Environment.Value("PAGE_LOAD_WAIT"))

        Set wElement = Description.Create()    
        wElement("micclass").value = "WebElement"                                                                                  
        wElement("html tag").value = "LABEL"    
        wElement("innertext").value = sNewPage
        If (oPage.WebElement(wElement).exist(1)) Then
            bPageExists = True
            Exit Do
        End If
    Loop
    ' Stop the page load timer and report the results to the test case log
    MercuryTimers(sNewPage).Stop
    
    If (cint (MercuryTimers(sNewPage).elapsedTime/1000) > cint (Environment.Value("PAGE_RESP_REQ"))) Then
        'The desired page NOT was loaded within the timeout parameter setting
    Else
        'The desired page was loaded within the timeout parameter setting
    End If
    WaitForWin_Wavemark = MercuryTimers(sNewPage).ElapsedTime

End function

Other Considerations:

All the window User Interface (UI) elapsed time measurements can be captured in Visual Basic globals and written out to a text file or an Excel spread sheet in graphical format.  This requires some additional function code and internal tool method implementations, which will be covered in a future Blog post. 

Click To Download and Try LoadRunner
Click to Download and Try UFT

 

Thank you,

James Burton, HP Enterprise Services
Senior Automation Engineer 
RTLS testing for Military Health & Veterans Affairs

 

 

How to record New Web Page in Jboss ServerOpen in a New Window

Folks,

   I am looking for the protocol in load runner to record New Web technology web pages inJboss.  Web HTTP/HTML Protocol is not able to record all the web pages since the landing application and confirmation page of the application only is having handshake with server,the web pages in between those are loaded from client side since the  server responds all end to end web page information while loading application landing page.Is there any protocol in LR to record and replay the web pages developed through New Web Technology.Please let me know if you need more explaination.

Regards

K Sakthivel

 

Can i get more explanation about correlation?Open in a New Window

Could you please provide the more explanations of correlation part in loadrunner 12.53 and is there any easy methods to do this?

Best Regards,

Omkar.

 

Right ClickOpen in a New Window

During recording in Ajax true client with Firefox browser , there is a flow where we have to RIGHT CLICK and then select view option, During record and replay at that particular time , it is working fine but later by default it takes the CLICK option instead of RIGHT CLICK, this is  because in the STEP : Action , there is no option called Right Click we have Click and Double Click options present in the drop down.

Can any one please help with any suggestion how can i capture Rightclick for the same.

 

Performance Center - Support Function Calls in the scripts?Open in a New Window

I am considering moving to Performance Center. Our current LoadRunner script assets are insanely complex and large. We support 10 applications with about 25 scripts per application. We accomplish it by what I presented at the 2000 Mercury World Conference and was later incorporated into QuickTest Professional -- Reusable Components. There still seems to not have this concept in LoadRunner / Performance Center. The only portion of this concept in LoadRunner is the ability to 'Import Action', but this is a one-way copy which does not allow for single-file maintenance. So we do it by hand. QUESTION: DOES PERFORMANCE CENTER SUPPORT C-Style FUNCTION CALLS OUTSIDE OF THE BASE SCRIPT?

What this means is we have a main script, and then a function library.  The main script has an include statement to include the function library.  This library has the Action Funtion for the home page.  All of the (75) scripts call the Home Page Action Function.  When they change the home page, we just update the one C file and all 75 scripts are now updated.  This is a huge time savings in maintaining 250 scripts.  My team is able to update the script assets after each of the two builds per week and often run a performance test the same business day.  If we have to make each of these scripts 'flat' with 75 scripts containing the Action Function code for the home page, we'd take hours to update one change in the home page, make editing errors, and consume many more hours fixing code. 

Here is an example.  The home page Action Section is:

HomePage()
{
    HomePage();
    return 0;
}

The globals.h includes this C Function:

#include "..\\Shared_Modules\CommonActions\HomePage.c"

And then in the C Function is the Action Function:

HomePage()
{

web_url("{Server}", 
        "URL=https://{Server}/", 
        "Resource=0", 
        "RecContentType=text/html", 
        "Referer=", 
        "Snapshot=t4.inf", 
        "Mode=HTML", 
        EXTRARES, 

....And so on....

 

One ALM for PC and QC , pro and cons ?Open in a New Window

Hi All,

Our management are puching for one ALM machine for both QC and PC. PC team does not like this idea because :

- QC has many user compare to PC.

- QC has many project compare to PC.

The downside of this is at PC can easily upgrade but to upgrade QC will takes month.Alsp release to release there are a lot of protocol updates in PC but may be for QC , not much updates.

Also PC and ALM patch sometime out of sync.

Any advice , should we go for one ALM for QC and PC ?

any pro and cons ?

Regards

mB

 

Webinar May 11: Performance Engineering as a Competitive DifferentiatorOpen in a New Window

In 2016 we have had a webinar a month, focused on Performance Engineering. [more on that within the blog link below]

 

On 11 May 2016 we are covering "Performance Engineering as a Competitive Differentiator" with a Host and 4 Expert Panel.

 

HOST:

Todd DeCapua,

 Chief Technology Evangelist [Hewlett Packard Enterprise]

 

PANELISTS:

Kishore Thota, Program Manager Performance Engineering [ NBC Universal] Bryon Colaizzi, Enterprise Performance Assurance [Biogen] Alan Korncoff, Chief Engineer [The Boeing Company] Dr. Andre B. Bondi, Consultant and Author Founder [Software Performance and Scalability LLC]

 

Learn more and sign up at the below blog now.

http://community.hpe.com/t5/LoadRunner-and-Performance/Performance-Engineering-as-a-Competitive-Differentiator-Webinar/ba-p/6852725

 

LG Machine turn to non-operationalOpen in a New Window

Hi,

I am currently experiencing "non-operational" or "Truclient has stopped" when performing my Load and Performance testing in HP Performance Center.

The solution that an HP Tech [gave us before is to change the perfromance agent configuration setting to "manually logon".

Is there a permanent solution to this, rather than setting the agent to manually logon?

Thanks,

Stephen

 

HP Load Runner Complete Study MaterialOpen in a New Window

From here can i get complete study material for load runner version 12.00 ???

 

Automating LoadRunner from PowerShell - any reference resources or examples anyone can share?Open in a New Window

I am trying to use PowerShell commands to fire a specific LoadRunner test. The test has been designed as part of the HP ALM interface.

HP documentation gives complete details of the REST API here: http://alm-help.saas.hp.com/en/12.50/api_refs/REST/webframe.htm#Overview.htm

There seems to be no reason why this should not be fired from standard PowerShell commands, but I can't find examples anywhere of how to do this, and the HP reference only contains Java examples (there are a few short C# examples on line as well).

Does anyone know of any examples which I can refer to? Or are you able to share any PS scripts which you may have working?

I would be very grateful for any help on this - working PowerShell to logon and retrieve a list of entities would be best, but even working PS code just to log on and create/delete a session would be great.

RSVP - thanks

 

winruuner cannot find objectOpen in a New Window

Hello, im usig winrunner 8.2 with XP sp3, as of last week my script is no longer working after investagating why I found out that it's no longer able to see the the objects I created as vb_name  can someone please assist?

 

When to Re-Script vs not toOpen in a New Window

Hi - I'm looking for some understanding of some best practices on when to re-script vs when not to. 

 

We have a HTTP/HTML script on a web application.  The project team made some code changes within their application that didn't affect the scripts behavior in anyway. 

 

When doing some monitoring under dyna-trace we still some aspx calls that adding 2 secs to our response time from our old scripts.  Even though the scripts are not showing any failures in them this aspx call are being generated and effecting our times.

 

Should a re-script be done because of this?

 

C handling functionsOpen in a New Window

How to read a data from a file and store it in a varaible for later use?

 

 

Appreciate your quick reply.

 

 

Thanks,

Satish

 

How to use Virtual Table ServerOpen in a New Window

I made this video on using VTS:

 

https://www.youtube.com/watch?v=BhN0Pp4I98M

 

Regards,

Mario M.

 

LoadRunner/MI istener Best PracticesOpen in a New Window

Hello!

 

Are there HP documents on LoadRunner/MI Listener topology and Best Practices?

 

 

We are preparing to run a performance test in which we have Load Generators installed at customer's networks. Load Generators inside each network share the same external IP so we thought it would be best to use port forwarding. However only one Load Gen at a time can be reached / network with this approach.

Question: Is there a better way to set this up so that we could reach all of the load gens? Would adding an MI Listener server between the Controller and Load Generators help?


 

 

Anyone Please share any useful document on web services protocolOpen in a New Window

Hi,

 

Currently I am working as performance test analyst with MNC, I just want to leran the web services protocol. Can you please share anyone had any reference document.

 

Regards,

Sesha

 

 

[Best Practices] LoadRunner .NET Protocol Filter Best PracticesOpen in a New Window

My colleague Malcolm Isaacs posted the following text on quite a few forums.

I’ve just posted a new Best Practices document on the SSO site, entitled “LoadRunner .NET Protocol Filter Best Practices” (you need to log in with your HP passport to see it).

The document provides concepts, guidelines and practical examples for recording and troubleshooting .NET scripts in Vugen.  There are problem patterns along with solutions, tips and techniques for recording, and methodologies.

Please send your feedback directly to me or to lt_cust_feedback@hp.com

Malcolm Isaacs
Functional Architect, Application Automation
HP Software
Email: malcolm.isaacs@hp.com

 

what is the best protocol for testing Oralce apps ( oracle financials )Open in a New Window

what is the best protocol for testing Oralce apps ( oracle financials )

 

Best practice for Client server application testingOpen in a New Window

Hi,

 

Can any one share 'Best practice for Client server application testing' , we need to do performance test for client server application written in VB 6.0.

 

Thanks

Ravi Allam

 

 

Your input countsOpen in a New Window

We're working on increasing the value you get from this community and would like to hear from you and get your perspective.  We've created a short survey to collect your inputs.   

 

Thank you in advance for sharing your thoughts and ideas.

John
jjeremiah@hp.com

Contact Us

Vivit Worldwide
P.O. Box 18510
Boulder, CO 80308

Email: info@vivit-worldwide.org

Mission

Vivit's mission is to serve
the Hewlett Packard
Enterprise User
Community through
Advocacy, Community,
and Education.