Use -G optionjmeter -n -t jmeter/jmeter_prometheus_TestName.jmx -R \"{NODES_IPS}\" -l internal_demo.jtl -e -o /var/www/html -Dnashorn.args=--no-deprecation-warning -Dserver.rmi.ssl.disable=true -GTestName=Release2_withoutDefaultValue"
LoadRunner Scripting Challenges
Sunday, 4 August 2024
How can we add tag in a Jmeter distributed architecture that has Master and slave machine to show that on Grafana .
Monday, 11 July 2022
Reguar Expressiion extractor in Jmeter to understand ORD ALL scenarion in LoadRunner
Using RegEx (Regular Expression Extractor) with JMeter
JMeter, the most popular open source performance testing tool, can work with regular expressions, with the Regular Expression Extractor. Regular expressions are a tool used to extract a required part of the text by using advanced manipulations. Regular expressions are popular when testing web applications because they can be used to validate and to perform operations on a response from a web application.
In JMeter, the Regular Expression Extractor is useful for extracting information from the response. For example, when you request a page and then need to get a link from the page that was downloaded. Another use case is saving the extracted information to a variable, so it can be used later on in the performance test, for example when testing an application that uses token authentication, like CSRF/XSRF.
In this article I’m going to share how to use the Regular Expression Extractor in JMeter.
I created a very simple test-plan, look at Figure 1:
You may notice one unknown element in the image; it is the Regular Expression Extractor post-processor. Let's look at it more closely, in Figure 2:
Regular Expression Extractor Syntax
When configuring the regular expressions in JMeter, use the same syntax as Perl5. But there is one very important difference between JMeter and Perl regexps processing. In Perl you have to use the “//” delimiter to specify regexp. So, the regular expressions reg might appear like this: ~/regular_expression/. But you cannot use “//” for the same purpose in JMeter, otherwise the regular expression will be parsed literally, and not logically. So, if you are using grouping in a regular expression, use the “()” parentheses to separate one group from another.
Configuring the Regular Expression Extractor
Now I will shortly describe all of this element's fields.
“Apply to” radio button
You can choose whether the regular expression will be applied to the main sample results, to the sub-samples/embedded resources, or both.
The possible options are:
- Main sample only - only applies to the main sample
- Sub-samples only - only applies to the sub-samples
- Main sample and sub-samples - applies to both main sample and sub-samples
- JMeter Variable - the expression is applied to the filled in variable
“Field to check” radio button
You can choose which field the regular expression is applied to. The possible options are:
- Body - the body of the response. The content of your web-page, excluding headers, will be parsed with the regular expression.
- Body (unescaped) - the body of the response, with all HTML escape codes replaced. Note that HTML escapes are processed without regard to context, so some incorrect substitutions may be made.
- Headers - the headers of the response or the request
- URL – the URL of the request
- Response Code - e.g. 200
- Response Message - e.g. OK
Name of Created Variable - the name of the variable where the parsing results will be saved in JMeter.
Regular Expression - fill in the regular expression to test.
Template - choose the group you would like to extract from the regular expression. '$1$' will extract group 1, '$2$' will extract group 2, and so on. $0$ will extract the entire expression. For example, if you have the word “economics” in your response and you search for the regular expression “(ec)(onomics)” and apply template $2$$1$, then in the output variable you will receive “onomicsec”. If you apply template $0$, then in the output variable you will receive "economics".
Match ¹. If there is several character sequences, allows specifying, which variant exactly should be used. Important note. If you set “Apply to” to “Main sample and sub-samples” and specify “Match ¹” = 3, than JMeter will select matching sequence from the 2nd sub-sample because 1st will be main sample. If zero is specified, JMeter will choose a match at random. If you specify negative number, e.g. “-2”
If the match number is set to a negative number, then all the possible matches in the sampler data are processed. The variables are set as follows:
refName_matchNr - the number of matches found; could be 0
refName_n, where n = 1,2,3 etc - the strings as generated by the template
refName_n_gm, where m=0,1,2 - the groups for match n
refName - always set to the default value
refName_gn - not set
Indicates which match to use. The regular expression may match multiple times.
Use a value of zero to indicate JMeter should choose a match at random.
A positive number N means to select the nth match.
That’s all about options of Regular Expression Extractor. And now I will show a couple of practical examples. In all examples I will use the same URL for extracting string by regexp, see Figure 3.
After extracting string it will be put to variable $pageLink and used in “pageLink” HTTP Request as it displayed in Figure 4.
Searching by word. If you need to extract string with regular expression that is a single word than fill Regular Extractor as in Figure 5.
After executing “tut.by” request and extracting regexp, we will get the following $pageLink = economics, and that will be used in “pageLink” request, Figure 6.
Using groups. You can move parts of regular expressions using groups. For example, you need to find word “economics”, but before putting it to $pageLink you want to rearrange parts of word. Look at the Figure 7 for the syntax
And what we’ll have in View Results Tree
Using classes in regexps. Regular expressions can use classes of characters. For example, [0-9] means “any of numeric symbol ”. If I set regexp as in Figure 9, than I will receive the 3rd appropriate result from response body.
“{5,6}” means that result should contain no less then 5 and no more then 6 characters. And what we will have in View Results Tree in Figure 10
Using “^”. “^” means inversion, e.g. regular expression [^0-9] will look for non-numeric symbols. So, I’ll set regexp as in Figure 11
And in View results Tree I will have very interesting situation, Figure 12
What happened? Look at Figure 13
We caught “carriage return” symbol and this is a reason of java.net.MalformedURLException. To repair regexp I’ll add “<” before it and restart test. Now it’s ok.
Of course, I cannot cover in one article all possible and impossible cases about using regular expressions. For more information you can refer to JMeter Regular Expressions Tutorial which has exhaustive information.
JMeter uses Jakarta ORO for regular expressions processing. You can quickly test your regular expressions using Jakarta ORO Demonstration Applet which is the fastest way of seeing result matches/groups/etc.
Thursday, 4 March 2021
How to convert SAZ fiddler file to JMX file
I was not able to open SAZ file directly into Jmeter, followed below steps:
First we have to convert SAZ file to HAR file
To convert a SAZ file to a .Jmx file:
- Double-click on the saved SAZ file, it should open Fiddler. Install Fiddler from Fiddler Download Page if necessary,
- Click on File > Export > All Sessions > HTTP Archive 1.2.
- Save HAR file
- Go to https://converter.blazemeter.com/ , upload your HAR file on the site , it will convert it into JMX.
- Open same JMX in your Jmeter.
Friday, 9 March 2018
how to integrate HP Loadrunner with Jenkins
Restart button.
- Click on the Jenkins>New Job menu option.
- Enter a Job Name – I named my RunLoadrunner – and click on the Build a free-style software project option. Click OK
- Under the your new project’s configuration scroll down to the Build section and click on the Add build step and click on the Execute HP tests from file system option
- Under Build you should now have an option for LoadRunner-Specific Settings.. – Click on it.
- Under the LoadRunner Settings enter the following:
- Controller Polling Interval – the time to poll the LR Controller for your scenario status
- Scenario Execution Timeout – this is the total time for the execution of all your scenarios
- Errors to Ignore – – during the run you can tell which errors to ignore
- Under the Build/Tests section enter the path to your LoadRunner scenario. For example my scenario named JnekinsDebug.lrs lives under my D:\myLoadRuner directory. So my Tests field =D:\myLoadRunner
- Under the Post-build Actions section click on the Add post-build action and select Publish HP tests result
- Apply and Save your settings
- Run the LR job you just created like you would any standard Jenkins job
Saturday, 3 March 2018
Ajax TruClient End events
identifying the end event
• Action Started - Dispatched when the action defined in the step is starting. For steps with objects (i.e. most steps) it will occur right after the object has been successfully found in the application.
• Action Completed - Dispatched when the action defined in the step is completed.
• Step network completed - Dispatched when the network activity associated with the step is completed. Ajax TruClient waits a small amount of time in order to make sure that no new requests are created after all other requests have ended. The threshold is configurable via the script Runtime Settings (default is 150ms).
• DOM Content Loaded - Corresponds to the "domcontentloaded" event and is dispatched when parsing of the page is completed. The event will be dispatched only if the step's action has triggered a page navigation.
• Document Loaded - Corresponds to the standard "load" event and is dispatched when the page is completely loaded, including frames/images/stylesheets. The event will be dispatched only if the step's action has triggered a page navigation.
• Dialog opened - A modal dialog has opened. The dialog can either be opened from JavaScript (using the alert/confirm/prompt functions) or is an authentication dialog.
Important links on Ajax truclient :
https://community.hpe.com/t5/LoadRunner-Practitioners-Forum/VUGen-Ajax-TruClient-Evaluate-JS-on-Object/td-p/2392313
https://community.hpe.com/hpeb/attachments/hpeb/sws-LoadRunner_SF/6769/1/LoadRunner11.00_AjaxTruClient_TipsTricks.pdf
Thursday, 8 December 2016
Difference between Application server and Web server ?
The Web server:
A Web server handles the HTTP protocol. When the Web server receives an HTTP request, it responds with an HTTP response, such as sending back an HTML page. To process a request, a Web server may respond with a static HTML page or image, send a redirect, or delegate the dynamic response generation to some other program such as CGI scripts, JSPs (JavaServer Pages), servlets, ASPs (Active Server Pages), server-side JavaScripts, or some other server-side technology. Whatever their purpose, such server-side programs generate a response, most often in HTML, for viewing in a Web browser.
Understand that a Web server's delegation model is fairly simple. When a request comes into the Web server, the Web server simply passes the request to the program best able to handle it. The Web server doesn't provide any functionality beyond simply providing an environment in which the server-side program can execute and pass back the generated responses. The server-side program usually provides for itself such functions as transaction processing, database connectivity, and messaging.
The application server:
As for the application server, an application server exposes business logic to client applications through various protocols, possibly including HTTP. While a Web server mainly deals with sending HTML for display in a Web browser, an application server provides access to business logic for use by client application programs. The application program can use this logic just as it would call a method on an object (or a function in the procedural world).
Such application server clients can include GUIs (graphical user interface) running on a PC, a Web server, or even other application servers. The information traveling back and forth between an application server and its client is not restricted to simple display markup. Instead, the information is program logic. Since the logic takes the form of data and method calls and not static HTML, the client can employ the exposed business logic however it wants.
In most cases, the server exposes this business logic through a component API, such as the EJB (Enterprise JavaBean) component model found on J2EE (Java 2 Platform, Enterprise Edition) application servers. Moreover, the application server manages its own resources. Such gate-keeping duties include security, transaction processing, resource pooling, and messaging. Like a Web server, an application server may also employ various scalability and fault-tolerance techniques.
Scenario 1: Web server without an application server
In the first scenario, a Web server alone provides the online store's functionality. The Web server takes your request, then passes it to a server-side program able to handle the request. The server-side program looks up the pricing information from a database or a flat file. Once retrieved, the server-side program uses the information to formulate the HTML response, then the Web server sends it back to your Web browser.
To summarize, a Web server simply processes HTTP requests by responding with HTML pages.
Scenario 2 resembles Scenario 1 in that the Web server still delegates the response generation to a script. However, you can now put the business logic for the pricing lookup onto an application server. With that change, instead of the script knowing how to look up the data and formulate a response, the script can simply call the application server's lookup service. The script can then use the service's result when the script generates its HTML response.
Additionally, most application servers also contain a Web server, meaning you can consider a Web server a subset of an application server. While application servers contain Web server functionality, developers rarely deploy application servers in that capacity. Instead, when needed, they often deploy standalone Web servers in tandem with application servers. Such a separation of functionality aids performance (simple Web requests won't impact application server performance), deployment configuration (dedicated Web servers, clustering, and so on), and allows for best-of-breed product selection.
Saturday, 3 December 2016
How to handle java script generated Session ID in Vugen using Load runner
You will need to figure this out from the page source. In my case, the sessionID is assigned a value of window.SessionId where window.SessionID = NewGuid()
The body of NewGuid() is -
function NewGuid() {
-------
------
var guid = ‘xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx’.replace(/[xy]/g, function (c) {
var r = Math.random() * 16 | 0, v = c == ‘x’ ? r : (r & 0×3 | 0×8);
return v.toString(16);
});
return guid;
}
This generates a session ID like : 3f58555c-d6f4-4b1e-ac2a-b89f5d173944
then Use web_js_run() function.
Save the above javascript code with .js extension in the script folder.
Add the script under Extra files via Add Files option
Go to RunTimeSettings -Preferences-Options-Web Javascript header-Enable running javascript code == change the value to Yes
Write the following function.the the result is stored in param1