Wednesday, 24 September 2014

Web Functions in Loadrunner

Function Name Description
web_add_auto_filter Sets criteria to include or exclude URLs when downloading
web_add_auto_header Adds a customized header to all subsequent HTTP requests.
web_add_cookie Adds a new cookie or modifies an existing one.
web_add_cookie_ex Adds a cookie with specified add behavior.
web_add_filter Sets criteria to include or exclude URLs when downloading.
web_add_header Adds a customized header to the next HTTP request.
web_cache_cleanup Cleans the content of the cache simulator.
web_cleanup_auto_headers Removes all previous customized headers from HTTP requests.
web_cleanup_cookies Removes all cookies currently stored by the Vuser.
web_concurrent_end Marks the end of a concurrent group.
web_concurrent_start Marks the beginning of a concurrent group.
web_convert_date_param Converts a date string stored in a parameter to a different format.
web_convert_from_formatted Converts a string created with one or more data format extensions back to the source format.
web_convert_param Converts an HTML parameter to a URL or text.
web_convert_to_formatted Formats data using one or more data format extensions.
web_custom_request Allows you to create a custom HTTP request with any method supported by HTTP.
web_disable_keep_alive Disables Keep-Alive HTTP connections.
web_dump_cache Save the Vuser cache to a file.
web_enable_keep_alive Enables Keep-Alive HTTP connections.
web_findSearches inside an HTML page for a specified text string.
web_get_int_property Returns specific information about the previous HTTP request.
web_global_verification Searches for text string in all subsequent requests.
web_global_verification_pause Suspends the specified checks set by web_global_verification.
web_global_verification_resume Resumes the specified checks suspended by web_global_pause.
web_image Emulates a mouse click on the image defined by the attributes.
web_image_check Verifies the presence of a specified image inside an HTML page.
web_load_cache Load the Vuser cache from a file.
web_link Emulates a mouse click on the link that is defined by the attributes.
web_reg_add_cookie Registers a search for a text string and adds a cookie if the text is found.
web_reg_cross_step_download Registers a request to continue processing script steps without waiting for the server to terminate the response.
web_reg_find Registers a search for a text string for the next Action function.
web_reg_save_param Deprecated: Use web_reg_save_param_ex or web_reg_save_param_xpath.Saves dynamic data from an HTML page to a parameter.
web_reg_save_param_ex Registers a request to save dynamic data located between specified boundaries to a parameter.
web_reg_save_param_regexp Registers a request to save dynamic data that matches a regular expression to a parameter..
web_reg_save_param_xpath Registers a request to find dynamic data in an HTML buffer that has been formatted as XML and save the data to a parameter.
web_remove_auto_filter Removes a filter on download content.
web_remove_auto_header Stops adding a specific header to subsequent HTTP requests.
web_remove_cookie Removes the specified cookie.
web_report_data_point Specifies a data point and adds it to the test results.
web_revert_auto_header Stops adding a specific header to subsequent HTTP requests, but generates Implicit headers.
web_save_header Saves request and response headers to a variable.
web_save_param_length Saves the length of a parameter.
web_save_timestamp_param Saves the current timestamp.
web_set_certificate Causes a script to use a specific certificate that is listed in the Internet Explorer registry.
web_set_certificate_ex Specifies location and format information of a certificate and key file.
web_set_max_html_param_len Sets the maximum length of retrieved dynamic HTML information.
web_set_max_retries Sets the maximum number of retries for an Action step.
web_set_option Sets a Web option.
web_set_proxy Specifies that all subsequent HTTP requests be directed to the specified proxy server.
web_set_proxy_bypass Specifies the list of URLs that scripts access directly, i.e., not via the specified proxy server.
web_set_proxy_bypass_local Specifies whether or not the proxy server should bypass local addresses.
web_set_secure_proxy Specifies that all secure HTTP requests be directed to the specified secure proxy server.
web_sjis_to_euc_param Converts an SJIS string to EUC and assigns it to a parameter.
web_set_sockets_option Sets an option for secure sockets.
web_set_timeout Specifies the maximum amount of time that a script waits for a specified operation to be performed.
web_set_user Specifies a login string for a Web server.
web_submit_data Performs an "unconditional" or "contextless" form submission.
web_submit_form Performs a POST request; submits forms.
web_switch_net_layer Specifies a network layer for replay. (WAP only)
web_url Performs a GET request; receives pages or images.

Tuesday, 23 September 2014

web_reg_save_param_regexp

Do you have a correlation which you can’t solve because the values of the left and right boundary are dynamic? Correlation is an essential part of performance test scripting and there are plenty of different challenges with correlation. Imagine having a value of “GraphA123567EndGraphA” and the goal is to correlate 123567
From the example above, the left and right boundaries would be “LB=GraphA” “RB=EndGraphA”
What if the word GraphA is dynamic and can be anything from GraphA-GraphZ?

There is a solution at hand!
Using web_reg_save_param_regex will allow the user to grab a correlation value using dynamic left and right boundaries. This function uses the power of regular expressions, below are a few examples:
Example 1:
Source: “GraphA123567EndGraphA”
Solution: web_reg_save_param_regexp(“ParamName=CorrValue”, “RegExp=\“Graph[A-Za-z]\”, \“([0-9]+)\”, \“EndGraph[A-Za-z]\””, LAST);
Result: 123567

Example 2:
Correlate the values from a drop down list of a form
Source: dropdown >>> red, blue, green
Solution: web_reg_save_param_regexp(“ParamName=ColourList”, “RegExp=option=[0-9]+>([A-Za-z])

  • {ColourList1}=red
  • {ColourList2}=blue
  • {ColourList3}=green
Example 3:
Correlate up till the end of 642
Source: J\u002blsGd3zj1qdP\u002bvk0vDRaKyJFde5tCa6spDEy08SNab1hP8j5GTs4j6\u002f\u002bTqOwvxMHEQZLWd\u002btu8NlHJrVAarIQ==|634998513832503642″];
Solution: web_reg_save_param_regexp(“ParamName=SecurityString”,”RegExp=\”([A-Z0-9a-z\\\\+]+==\\|[0-9]+)\”\\];”,LAST);
Result:J\u002blsGd3zj1qdP\u002bvk0vDRaKyJFde5tCa6spDEy08SNab1hP8j5GTs4j6\u002f\u002bTqOwvxMHEQZLWd\u002btu8NlHJrVAarIQ==|634998513832503642

Example 4:
Correlate only “634998513832503642” Source:

<em>J\u002blsGd3zj1qdP\u002bvk0vDRaKyJFde5tCa6spDEy08SNab1hP8j5GTs4j6\u002f\u002bTqOwvxMHEQZLWd\u002btu8NlHJrVAarIQ==|634998513832503642"];</em>
Solution:
web_reg_save_param_regexp("ParamName=SecurityString",
    "RegExp=\"[A-Z0-9a-z\\\\+]+==\\|([0-9]+)\"\\];",
    LAST);
Result: 634998513832503642
So what is a Regular Expression?
Also known as regex, a regular expression is a search string which enables matching of a string. Think of it as an advance searching function which can pick out values from a string of multiple characters.

Examples of regex:
  • \d matches a single digit
  • \w matches a single word (including alphanumeric characters and underscore)
  • [A-Z]+ matches any word which is upper case
  • [a-z]+ matches any word which is lower case
  • [0-9]+ matches any numeric value
There are other alternatives to web_reg_save_param_regexp. However these functions are limited and not as flexible.
LB/DIG RB/DIG – # will be a wildcard for a numeric value“session_id_##”
  • Adding LB/IC/DIG will ignore case
  • “LB/IC/DIG=session_id_##=” (e.g. Session_id_20)
LB/ALNUM or RB/ALNUM – ^ will be a wildcard for an alphanumeric value
  • ALNUMIC – ignore case
  • ALNUMLC – match only lower case
  • ALNUMUC – match only upper case
SaveOffSet
  • If there is a dynamic value for a boundary e.g. “session_id_2” (3,4,5)
  • SaveOffSet = 2 (to cover “2=”)
  • Web_reg_save_param(“SessionID”, “LB=session_id_”, “RB=\””, “SaveOffSet=2”, LAST);
LR implementation
  • PERL based
  • LR 11 does not support multiple capture groups however this is now supported in LR 11.52 (example below)
Example Multiple Capture Groups
Source: rows”:[[“NW,RO,RA","DLY","10/07/2011","10/17/2011","10/01/2011","RA","Y","FR","AMEA","AC","1945","50","50","AC 100IOSH-08","UserDefined","10/07/2011","Reassigned"..."

Solution: web_reg_save_param_regexp("ParamName=ParamValue","RegExp=rows":\[\[“[^"\r\n]*”,”([A-Z]{3})”,”[^"\r\n]*”,”[^"\r\n]*”,”[^\/]+\/[\d]+?\/2011″,”[A-Za-z]*”,”[^"\r\n]*”,”[^"\r\n]*”,”([^"\r\n]*)”,”[^"\r\n]*”,”([^"\r\n]*)”,LAST);
Result:
  • {ParamValue1} = DLY
  • {ParamValue2} = AMEA
  • {ParamValue3} = 1945

Web_Set_Max_Html_param_Len ()

How can we update the length of the parameter? Web_Set_Max_Html_param_Len ().
Default session id length – 256 Characters
To update length of the parameter
Web_set_max_html_length (“1024“) function is used to set the maximum length to the parameter to update the length of the parameter

Types of performance testing?

Load testing:Load testing is conducted to verify that your application can meet your desired performance objectives; these performance objectives are often specified in a service level agreement (SLA). A load test enables you to measure response times, throughput rates, and resource-utilization levels, and to identify your application’s breaking point, assuming that the breaking point occurs below the peak load condition.

purpose:To verify application behavior under normal and peak load conditions.

Stress testing – involves testing an application under extreme workloads to see how it handles high traffic or data processing .The objective is to identify breaking point of an application

Purpose:To determine or validate an application’s behavior when it is pushed beyond normal or peak load conditions.
Endurance testing – is done to make sure the software can handle the expected load over a long period of time.

Spike testing – tests the software’s reaction to sudden large spikes in the load generated by users.
Volume testing – Under Volume Testing large no. of. Data is populated in database and the overall software system’s behavior is monitored. The objective is to check software application’s performance under varying database volumes.

Scalability testing – The objective of scalability testing is to determine the software application’s effectiveness in “scaling up” to support an increase in user load. It helps plan capacity addition to your software system.
Capacity testing:Capacity testing is conducted in conjunction with capacity planning, which you use to plan for future growth, such as an increased user base or increased volume of data. For example, to accommodate future loads, you need to know how many additional resources (such as processor capacity, memory usage, disk capacity, or network bandwidth) are necessary to support future usage levels.
Capacity testing helps you to identify a scaling strategy in order to determine whether you should scale up or scale out.
Purpose:To determine how many users and/or transactions a given system will support and still meet performance goals.

Types of VUsers

Types of VUsers

LoadRunner has various types of Vusers. Each type is designed to handle different aspects of today's client/server architectures.

You can use the Vuser types in any combination in a scenario in order to create a comprehensive client/server test. The following Vuser types are available: 

The Vuser types are divided into the following categories:

All Protocols: a list of all supported protocols in alphabetical order. 

  1.  Application Deployment Solution: For the Citrix protocol. 
  2. Client/Server: For DB2 CLI, DNS, MS SQL, ODBC, Oracle (2-tier), Sybase 
  3. Ctlib, Sybase Dblib, and Windows Sockets protocols. 
  4. Custom: For C templates, Visual Basic templates, Java templates, 
  5. Javascript and VBscript type scripts. 
  6.  Distributed Components: For COM/DCOM, Corba-Java, and Rmi -Java protocols. 
  7. E-business: For FTP, LDAP, Palm, Web (HTTP/HTML), Web Services, and the dual Web/Winsocket protocols. 
  8.  Enterprise Java Beans: For EJB Testing and Rmi-Java protocols. 
  9. ERP/CRM: For Baan, Oracle NCA, Peoplesoft-Tuxedo, Peoplesoft 8, 
  10. SAPGUI, SAP-Web, and Siebel (Siebel-DB2CLI, Siebel-MSSQL, Siebel-Web, and Siebel-Oracle) protocols. 
  11.  Legacy: For Terminal Emulation (RTE). 
  12.  Mailing Services: Internet Messaging (IMAP), MS Exchange (MAPI), POP3, and SMTP. 
  13.  Middleware: Jacada and Tuxedo (6, 7) protocols. 
  14.  Streaming: For MediaPlayer and RealPlayer protocols. 
  15.  Wireless: For i-Mode, VoiceXML, and WAP protocols. 
Unlike a WinRunner workstation which emulates a single user's use of a client, LoadRunner can emulate thousands of Virtual Users.

Load generators are controlled by VuGen scripts which issue non-GUI API calls using the same protocols as the client under test. But WinRunner GUI Vusersemulate keystrokes, mouse clicks, and other User Interface actions on the client being tested Only one GUI user can run from a machine unless LoadRunner Terminal Services Manager manages remote machines with Terminal Server Agent enabled and logged into a Terminal Services Client session.
During run-time, threaded vusers share a common memory pool. So threading supports more Vusers per load generator.

The Status of Vusers on all load generators start from "Running", then go to "Ready" after going through the init section of the script. Vusers are "Finished" in passed or failed end status. Vusers are automatically "Stopped" when the Load Generator is overloaded.

No additional license is needed to monitor standard web (HTTP) servers (Apache, IIS, and Netscape).

To use Web Services Monitors for SOAP and XML, a separate license is needed, and vUsers require the Web Services add-in installed with Feature Pack (FP1)

Monday, 22 September 2014

lr_save_datetime function in Loadrunner


LoadRunner stores date/time parameters locally on the LoadRunner PC. This means that opening a script
 on another users PC, where the date/time parameter is not stored, can cause corruption to the date/time 
parameters in a script. You know that this has happened when a date/time parameter in this format
 [%Y%m%d%H%M%S] is sent to the server rather than the format that you intended.

Due to this problem, It is recommend that the lr_save_datetime function is used to save date or time

 values to a string. The string can then be used in the script and the script is portable between PCs because
 we are no longer relying on the locally stored parameters.

Sample code

lr_save_datetime("%d/%m/%y", DATE_NOW, "DDMMYY");
lr_output_message("Today's Date is %s",lr_eval_string("{DDMMYY}"));

lr_save_datetime("%d/%m/%Y", DATE_NOW, "DDMMYYYY");
lr_output_message("Today's Date is %s",lr_eval_string("{DDMMYYYY}"));

lr_save_datetime("%B %d %Y", DATE_NOW, "Today");
lr_output_message("Today is %s",lr_eval_string("{Today}"));

lr_save_datetime("%B %d %Y", DATE_NOW + ONE_DAY, "Tomorrow");
lr_output_message("Tomorrow is %s",lr_eval_string("{Tomorrow}"));

lr_save_datetime("%A", DATE_NOW - ONE_DAY, "Yesterday");
lr_output_message("Yesterday was %s",lr_eval_string("{Yesterday}"));

lr_save_datetime("%A", DATE_NOW, "Today");
lr_output_message("Today is %s",lr_eval_string("{Today}"));

lr_save_datetime("%A", DATE_NOW + ONE_DAY, "Tomorrow");
lr_output_message("Tomorrow is %s",lr_eval_string("{Tomorrow}"));

lr_save_datetime("%X", TIME_NOW , "Time");
lr_output_message("The time is %s (in this locale's date format)",lr_eval_string("{Time}"));

lr_save_datetime("%X", TIME_NOW + ONE_HOUR , "Time");
lr_output_message("In one hour it will be %s",lr_eval_string("{Time}"));

lr_save_datetime("%A", DATE_NOW + ONE_DAY, "Tomorrow");
lr_output_message("Tomorrow is %s",lr_eval_string("{Tomorrow}"));

lr_save_datetime("%j", DATE_NOW, "Today");
lr_output_message("Today is day %s in the year",lr_eval_string("{Today}"));

lr_save_datetime("%Z", DATE_NOW, "TimeZone");
lr_output_message("This machine is in the '%s' time zone",lr_eval_string("{TimeZone}"));

lr_save_datetime("%p", DATE_NOW, "AMPM");

if (strcmp (lr_eval_string("{AMPM}"),"PM")!=0)
{
lr_output_message("Good Morning");
}
else
lr_output_message("Good Afternoon");

Sunday, 21 September 2014

SCOM (System Center Operations Manager) Monitoring tool


System Center Operations Manager 2012 – the complete application monitoring solution

For many years Operations Manager has delivered infrastructure monitoring, providing a strong foundation on which we can build to deliver application performance monitoring. It is important to understand that in order to provide the application level performance monitoring, we must first have a solid infrastructure monitoring solution in place. After all, if an application is having a performance issue, we must first establish if the issue is due to an underlying platform problem, or within the application itself.

A key value that Operations Manager 2012 delivers is a solution that uses the same tools to monitor with visibility across infrastructure AND applications.

To deliver application performance monitoring, we provide 4 key capabilities in Operations Manager 2012:
Infrastructure monitoring – network, hardware and operating system
Server-side application monitoring – monitoring the actual code that is executed and delivered by the application
Client-side application monitoring – end-user experiences related to page load times, server and network latency, and client-side scripting exceptions
Synthetic transaction – pre-recorded testing paths through the application that highlight availability, response times, and unexpected responses

Configuring application performance monitoring

So it must be hard to configure all this right? Lots of things to know, application domain knowledge, settings, configurations? Rest assured, this is not the case! We make it incredibly easy to enable application performance monitoring!

1. Define the application to monitor.



2. Configure server-side monitoring to be enabled and set your performance thresholds



3. Configure client-side monitoring to be enabled and set your performance thresholds



And that’s it, you’re now set to go. Of course setting the threshold levels is the most important part of this, and that is the one thing we can’t do for you… you know your application and what the acceptable performance level is.
Configuring an application performance dashboard in 4 steps

It’s great that we make the configuration of application performance monitoring so easy, but making that information available in a concise, impactful manner is just as important.

We have worked hard to make the creation of dashboards incredibly easy, with a wizard driven experience. You can create an application level dashboard in just 4 steps:

1. Choose where to store the dashboard



2. Choose your layout structure. There are many different layouts available.



3. Specify which information you want to be part of your dashboard.



4. Choose who has access to the dashboard. As you will see a little later in this article, publishing information through web and SharePoint portals is very easy.



And just like that, you’ve created and published an application performance monitoring dashboard!


Anyone who has either worked in IT, or been the owner of an application knows the conversations and finger pointing that can go on when users complain about poor performance. Is it the hardware, the platform, a code issue or a network problem?

This is where the complete solution from Operations Manager 2012 really provides an incredible solution. It’s great that an application and associated resources are highly available, but availability does not equal performance. Indeed, an application can be highly available (the ‘5 nines’) but performing below required performance thresholds.

The diagram below shows an application dashboard that I created using the 4 steps above for a sample application. You can see that the application is available and ‘green’ across the board. But the end users are having performance issues. This is highlighted by the client side alerts about performance.






Deep Insight into application performance

Once you know that there is an issue, Operations Manager 2012 provides the ability to drill into the alert down to the code level to see exactly what is going on and where the issue is.




Reporting and trending analysis

An important aspect of application performance monitoring is to be able to see how your applications are performing over time, and to be able to quickly gain visibility into common issues and problematic components of the application.

In the report shown below, you can see that we can quickly see areas of the application we need to focus on, and also understand how these components are related to other parts of the application, and may be causing flow-on effects.




Easily make information available
With Operations Manager 2012, we have made it very easy to delegate and publish information across multiple content access solutions. Operations staff have access to the Operations Manager console, and we can now easily publish delegated information to the Silverlight based Operations web console and also to SharePoint webparts.