Wednesday, March 19, 2014

Correlation in JMeter

What is correlation and why it is required?Correlation is the most important aspect of scripting. It generally includes fetching dynamic data from preceding requests/calls and posting it to the subsequent requests.

Let’s take an example,Suppose we have recorded a scenario in which
  1. User enters login details and click OK button
  2. Home page opens and user take further actions
Now, if we just playback this script, the test will fail even for a single user. This is because of the authentication mechanism used. When we login to a website, session variables are dynamically created. These session variables are passed to the subsequent requests and help validation and authentication of the actions performed. So, one cannot just record and playback the requests having these variables. Here, we need to correlate the web requests with the dynamic variables. And for correlation, we need to use the “Regular Expression Extractor” which makes use of regular expressions.

A brief insight to regular expressions:

Regular expressions are used to fetch data from a string based on a search pattern. Basically, what we do is- in order to extract any value (generally a dynamically created value) from a string (text response), we define a left bound of the variable then some wildcard characters and then right bound-
(Left Bound)(Wildcard Characters)(Right Bound)
E.g. for if we have text response like-
.......__EVENTVALIDATION"value="weriudflsdfspdfusdjfsisdpfjpsdfohsdihffgdfgdfgdfgdfgdfgdfglsdjkfpjspdfjsdjfpj" />…..
And we need to extract the value of Event validation variable using regular expressions; the regular expression for the same will be-
__EVENTVALIDATION" value="(.+?)" /> where, Left Bound = __EVENTVALIDATION" value="
Wildcard characters = (.+?)
Right Bound = " />
If you do not want to get deeper into regular expressions, then the wildcard characters (.+?) would suffice in most of the cases. For more information on regular expressions and meaning of each wild card character visit http://www.regular-expressions.info/tutorialcnt.html.

Regular Expression Extractor:Coming back to JMeter, consider an example where we have two operations-
1. User launch website
2. User fill details and click on OK button
Now, the call user launch website creates a dynamic variable event validation that we can check in Response Data tab of “View Result Tree” listener for the call. The value of this variable is then passed to subsequent call related to “User fill details and click on OK button” as Http post parameter.

Steps for correlating the Event validation values:1. Run the script containing the both the above stated operations
2. Go to Response tab (Text mode) in “View Result Tree” listener of “User launch website” operation. BTW, we see the second operation “User fill details and click on OK button” in red because it is not yet correlated.




3. Create a Regular expression for extracting the value of Event validation variable’s value. As stated above the R.E. for this will be-
__EVENTVALIDATION" value="(.+?)" />

4. Go to http request under “User Launch Website” transaction controller-> Add -> Post Processor -> Regular Expression Extractor.


Adding “Regular Expression Extractor” control



R.E. Extractor Parameters Filled

5. The reference name inserted is the name of the variable created that will capture the value Event validation generated by the http request under “User launch website” operation.

6. Now pass this variable to the subsequent http request under “User fill details and click on OK button” as post request- overriding the already present hardcoded value of Event Validation variable.


Request without correlation (Hardcoded values)



Request with correlation (Dynamic values)

7. Run the Test plan again. All green? That's it.

This was all about correlation. In order to get good understanding of correlation (or scripting for that matter) we need to have a good understanding of two things- the dynamic variables generated by the programming languages and Regular expressions.

whats new in HP Performance Center 12?

Businesses and clients are looking for faster delivery of applications than ever before, but still require a gold standard of quality. Built with the customer in mind, Apps 12 enables customers to deliver applications with unprecedented velocity, while maintaining first-rate quality and performance. Apps 12 provides the ability to build, test and deliver at all levels of scale; adding unparalleled flexibility necessary to support the wide range of technologies and environments that encompass the new style of IT. In pressing times for customers to produce faster and better than ever, HP provides application development and testing teams a partner in which to guide them through these ever-changing demands.

In addition to speed, delivering a successful app is an enterprise’s top priority. An application’s performance largely determines its success and whether or not the app will be used. If it doesn’t work properly, it will not provide users with any end benefits. To ensure an app’s performance is up to par, it is essential to test its performance properly. With HP LoadRunner and Performance Center software, the market-leader in performance engineering and load testing, users have the #1 tool to test their app’s performance thoroughly and accurately. In version 12, a multitude of enhancements were made to its testing capabilities focused around cloud, mobile and continuous testing. Read on as we dive deeper into each type of testing.



Cloud Testing:
In version 12, HP Performance Center and HP LoadRunner leverage public cloud infrastructure to deploy LoadGenerators (LGs). Users can seamlessly scale up and down tests based on performance testing needs or requirements, without complicated network configurations. With the utilization of cloud testing and the ability to elastically scale up tests, the demands of customer-centric business applications are met with ease and accuracy. As a result, enterprises can significantly reduce cost and lower the overall overhead of managing dedicated infrastructure.

With cloud based LGs, HP LoadRunner and Performance Center significantly reduce the provisioning time of performance testing, while maintaining the same level of security and control. Specifically in LoadRunner, users can add multiple cloud accounts and manage their network profiles for connecting to their various LGs. With Performance Center, existing cloud accounts can be managed centrally via Lab Management, and LGs can be allocated to individual projects. In addition, users can provision hosts and manage their usage with the built-in reporting feature.
Mobile Testing:
In the latest version, users can now test any mobile application, whether it is built in-house or by a third party, on any platform. Users have more flexibility with mobile testing than ever before. This means fewer applications will go untested, and a wider variety of mobile clients can be covered in each test scenario.

Version 12 also allows testers to test performance the way they need it, with the most complete and realistic mobile performance testing capabilities to date. With the growth of the mobile application market, including realistic network conditions is critical to understanding how the app performs. HP LoadRunner and Performance Center are integrated with Shunra Network Virtualization to provide users with complete control over their network conditions during testing. Other benefits and enhancements of Shunra Network Virtualization include:

Improved Integration with HP software to enable you to perform network virtualization per virtual user group and to define multiple locations per load generator

New network virtualization graphs for monitoring and analysis
Added support for shared or non-shared bandwidth that simulates mobile networks

Continuous Testing:

In version 12, testing performance early and often is the name of the game. LoadRunner provides users with the tools and APIs to introduce performance testing earlier in the application lifecycle. The REST API’s automatically trigger performance tests to be done from CI/build systems, and matched against service level agreements (SLAs) for consistent updates. By leveraging unit tests and automated testing processes, users are able to provide early feedback to the developers, which keep the lifecycle from falling behind.

The Performance Application Lifecycle (PAL) feature in Performance Center allows for complete end-to-end testing and DevOps feedback. Users can accurately compare performance test results with real production data benchmarks gathered from HP Application Performance Monitoring products. Analysis of these results provides important feedback that can help users fine-tune their performance test scenarios to resemble realistic environments as closely as possible, which reduces test assumptions and risks.

Connection Timeout Error:Failed to connect server in load runner


" Error -27796: Failed to connect to server "test.propertyinstant.com:80": [10060] Connection timed out " this error.
Solution:
Go to Run time settings->Preferences->options, there in HTTP properties you will find on option "HTTP-request connect timeout" set it to 1000 and then re run it will not fail after this.

Please make sure that manually you are able to connect to server. If not then there is a problem with server.

TRY:

HTTP-request connect timeout (sec).......1000
HTTP-request receive timeout (sec)........600

HTTP Keep-Alive timeout (sec)................600

Shunra VE Desktop for HP LoadRunner

The only WAN emulation technology now featured and integrated directly within HP LoadRunner v9.5
Upgrade to HP LoadRunner 9.5 or HP Performance Center 9.5 and have access to Shunra's WAN emulator directly while load testing for the most successful performance testing results. Access to the only HP Certified WAN Emulation solution on the market that was co-developed by HP Software and Shunra offers new powerful benefits:
  • Enables each load generator to emulate a different network location
  • Eliminates the need to deploy load generators remotely
  • Aggregates end-to-end results into a single database
  • Replaces LoadRunner WAN Emulation (MWE), last seen in LoadRunner version 8.1 (released July 2005)
  • Achieves thorough performance testing with WAN Emulation
  • Makes existing testing scripts network-aware with a click of a button

WAN emulator is conducted on a per load generator basis. Since this is a co-developed solution, it is seamlessly integrated and intuitive to configure and use. There are no script edits required, no limits on test scheduling, and results are automatically saved within the scenario.

How does WAN Emulation work with load testing?
When configuring WAN Emulation within HP LoadRunner, there are no script changes required. For more advanced configurations, use the Network Editor capability to select advanced network settings no longer tied to a server. Key advanced testing options include:
  • Jitter and packet loss patterns
  • Asymmetric bandwidth
  • Congestion
  • Link Failures
  • Eliminate Global Load Generators
No need to install and manage load generators in remote offices around the world
Benefit directly from deployment of WAN Emulation with accurate user load testing
Ability to locally schedule, re-run or configure network aware testing
Enable scripts to act as if they are in any location

WAN Emulation with Load Testing is an Essential Best Practice
Defining a valid load test environment is complex. If the environment does not reflect real-world conditions it is probable that the results and decisions made to deploy the application will not be valid. Shunra's experience in helping customers maximize the effectiveness of their load testing process has shown that without incorporating the impact of the WAN on the production infrastructure, the results of load tests are usually incomplete. Use of Shunra WAN Emulation along with load testing enables the detection of:

Latency impact – Latency is the number one most significant network impact on applications today. It is also something that you have very little control over. Latency causes the transactions and sessions to stay open longer than they would on a LAN. Without incorporating the WAN effects of delay into a load test, memory usage, thread usage, and other critical server resources can be significantly understated.

Bandwidth limitations – Bandwidth limits how much data can be transferred in a certain amount of time. Its constraints affect transactions "in-flight" causing them to take longer to complete and impacting important server resources.

Network impact – Where specific response time goals are being targeted, it is important to incorporate the overall effect of the network into testing to examine the impact on total response time.

Shunra enables you to accurately assess total response time for remote users prior to deployment, and can analyze the breakdown of total response time into the client, network, and server components.

This enables users to diagnose and resolve transactions that will not consistently meet your response time goals.

Shunra in load runner


Shunra NV (Network Virtualization) for HP Software is the only HP-certified solution specifically designed to accelerate and optimize application performance testing across WAN, web, mobile and Cloud networks. Shunra NV for HP Software integrates seamlessly into HP LoadRunner and Performance Center, enhancing the accuracy of testing by incorporating production network conditions into the load and performance test environment.

Shunra NV for HP Software enables an effective application performance engineering methodology, providing the capabilities todiscover and then virtualize real-world network conditions in the test environment, analyze test results in order to isolate potential bottlenecks, and automatically deliver custom performance optimization recommendations.

Shunra NV for HP Software features easy configuration, requires no script editing and places no limits on test scheduling. In addition, test results and data are automatically stored with HP results files and segregated by emulated location for precise and actionable analysis.

From within the familiar HP Software interface, organizations can leverage Shunra NV for HP Software to:

Discover production network conditions and access Shunra's global library of mobile and broadband conditions directly from Performance Center and LoadRunner.
Enable each load generator in a test environment to emulate up to 100 different networks or locations, thereby reducing or eliminating reliance on remote load generators while also making it easy to configure multiple networks in a complex environment.
Allocate bandwidth per virtual user in a load test, a critical element for mobile app testing where bandwidth availability is dynamic and varies for each individual user.
Aggregate test results into a single database for ease and completeness of location-specific analysis.
Extend testing scripts with a single click.

Automate reporting and analysis for Performance Engineers, Line of Business Owners and other business constituents.

Because performance is the number one factor influencing application use and adoption, and ultimately business success, accurate and reliably predictive pre-production testing is a requirement. Shunra NV for HP LoadRunner and for HP Performance Center provides the capabilities needed to achieve this level of confidence with performance testing.