In this article, We will talk about how to handle dynamic data in JMeter which is basically Correlation. Correlation is the important aspect of scripting. Proper handling of dynamic data results in building effective test scripts.
What is Correlation and why is it required ?
Correlation is an act of fetching dynamic data from preceding requests/calls and posting it to the subsequent requests/calls. Lets envision an example to find out why we need correlation. Suppose we have recorded a scenario in which user does the following transactions
- User enters login details and click submit button,
- Home page opens and user take further actions,
- And then Logs out of the system.
Soon after recording if you try to run the script, it may even fail for a single user. This might be because of numerous reasons, lets assume that one of the reason might be authentication mechanism implemented. When a user logged into the system, a unique session is created for user and it will be active until the user logs out of the system. Lets imagine, a unique tokenId is dynamically generated up on user login and is passed to the subsequent requests to validate the user actions. So, one cannot just record and playback the requests having these tokenId’s which are unique for every user sessions. Here, we need to correlate the web requests with the dynamic variables (tokenId). And for correlation, we need to use the “Regular Expression Extractor” which makes use of regular expressions or most commonly known as RegEx.
Continue reading Correlation: Dynamic data handling using Apache JMeter
The WordPress.com stats helper monkeys prepared a 2014 annual report for this blog.
Here’s an excerpt:
A New York City subway train holds 1,200 people. This blog was viewed about 4,000 times in 2014. If it were a NYC subway train, it would take about 3 trips to carry that many people.
Click here to see the complete report.
In this article, I will talk you through about the next set of JMeter elements i.e Assertions. These elements plays a crucial role in validating samplers in our test scripts. Lets discuss in detail about the advantages and disadvantages in using assertions. In case if you have missed the older articles click here.
From the previous posts, we are all aware that how to send requests and get response from the target server. Now you may have many questions running in your mind like are we receiving expected or desired response from the server, how can we validate the received response through JMeter. In this case, Assertions come to your rescue !!
Assertions are used to perform additional checks on samplers, and are processed after every sampler in the same scope. To ensure that an Assertion is applied only to a particular sampler, add it as a child of the sampler. By default assertions can be applied only to main samples but JMeter also provides an options to include assertions only to sub-samples or both. Scope of the assertions can be as follows:
If a sub-sampler fails and the main sample is successful, then the main sample will be set to failed status and an Assertion Result will be added. If the JMeter variable option is used, it is assumed to relate to the main sample, and any failure will be applied to the main sample only. More than one assertion can be added to the sampler, controller, thread group or test plan. Failed assertions will cause all affected samples to fail.
Continue reading JMeter Complete Element Reference – Part VII
In this article, we will discuss about the next set of JMeter elements i.e Pre-Processors and Post-Processors. Lets discuss in detail, how do we use these elements to build a effective test scripts . In case if you have missed the older articles click here.
Pre Processor Elements
A Pre-Processor elements executes some action prior to a Sampler Request being made. If a Pre-Processor is attached to a Sampler element, then it will execute just prior to that sampler element running. A Pre-Processor is most often used to modify the settings of a Sample Request just before it runs, or to update variables that aren’t extracted from response text.
Post Processor Elements
A Post-Processor elements executes some action after a Sampler Request has been made. If a Post-Processor is attached to a Sampler element, then it will execute just after that sampler element runs. A Post-Processor is most often used to process the response data, often to extract values from it.
Execution order of the Elements:
Lets understand in which order JMeter process the elements when multiple elements are added to the thread group.
Please note that Timers, Assertions, Pre- and Post-Processors are only processed if there is a sampler to which they apply. Logic Controllers and Samplers are processed in the order in which they appear in the tree. Other test elements are processed according to the scope in which they are found, and the type of test element.
Continue reading JMeter Complete Element Reference– Part VI
In this article, we will discuss about the next set of elements i.e Timers, importance of timers, types of timers and their usage in our test. In case if you have missed the older articles, click here 1, 2, 3, 4.
Apache JMeter sends requests to the target server without pausing between each request by default. In that case, the target server can be over flooded with numerous requests with in a very short span which may lead to server overload. So how to prevent jmeter from overloading the target server and how to pace each request in our test execution to achieve real time behavior. The answers is quite simple Timer. 🙂
Timers allow JMeter to delay between each request which a thread makes. Timer can solve the server overload problem. Also, in real life visitors do not arrive at a website all at the same time, but at different time intervals. So Timer will help mimic the real time behavior.
Timers are only processed in conjunction with a sampler. A timer which is not in the same scope as a sampler will not be processed at all. To apply a timer to a single sampler, add the timer as a child element of the sampler. If a timer is placed before a sampler in the test script, timer will be applied before executing before any sampler. To apply a timer after a sampler, either add it to the next sampler, or add it as the child of a Test Sampler.
Continue reading JMeter Complete Element Reference – Part V
In this article, we will discuss about the next set of elements i.e Logic Controllers, importance of controllers, types of controllers and their usage in our test. In case if you have missed the older parts, click here 1, 2, 3.
Logic Controllers let you customize the logic that JMeter uses to decide when to send user requests. Logic Controllers basically determine the order in which Samplers are processed. They can modify the requests themselves, cause JMeter to repeat requests, etc.
Continue reading JMeter Complete Element Reference – Part IV
But what if a website uses SSL encryption?
Then, you better make some configuration changes. How? We’ll tell ya’.
Record HTTPS Traffic with the JMeter Proxy Server
By default, JMeter supports recording HTTPS (SSL) in versions 2.3.4+ and HTTP Samplers are configured to accept all certificates, whether trusted or not.
To record encrypted traffic, first configure the JMeter Proxy Server and browser proxy settings. We used Firefox for this example.
In this article, we will discuss about the next set of elements i.e Configuration Elements, importance of configuration elements, types of configuration elements and their usage in our test. In case if you have missed the first part and second, click part1, part2 .
Configuration elements can be used to set up defaults and variables for later use by samplers. Note that these elements are processed at the start of the scope in which they are found, i.e. before any samplers in the same scope.
Continue reading JMeter Complete Element Reference – Part III
In the last article, we discussed about Samplers, sampler usage and many more . In case if you have missed click here. In this article, We will discuss about the most important and frequently used sampler i.e “HTTP Request Sampler”.
HTTP Request Sampler
This sampler lets you send an HTTP/HTTPS request to a web server. It also lets you control whether or not JMeter parses HTML files for images and other embedded resources and sends HTTP requests to retrieve them. The following types of embedded resource are retrieved:
- external scripts
- frames, iframes
- background images (body, table, TD, TR)
- background sound
The default parser is htmlparser. This can be changed by using the property “htmlparser.classname” – see jmeter.properties for details.
If you are going to send multiple requests to the same web server, consider using an HTTP Request Defaults Configuration Element so you do not have to enter the same information for each HTTP Request.
Or, instead of manually adding HTTP Requests, you may want to use JMeter’s HTTP(S) Test Script Recorder to create them. This can save you time if you have a lot of HTTP requests or requests with many parameters.
Continue reading HTTP Request Sampler
In this article, we will discuss about the next set of elements i.e Samplers, importance of samplers, types of samplers and their uasge in our test. If you have missed the first part, click here
Samplers perform the actual work of JMeter. Each sampler (except Test Action) generates one or more sample results. The sample results have various attributes (success/fail, elapsed time, data size etc) and can be viewed in the various listeners(will get to know in future posts 😛 ).
As we all know that Apache JMeter has ability to load and performance test many different server/protocol types such as HTTP, FTP, SOAP, LDAP, JDBC etc and we aslo know that Thread Group forms the base for simulating requests to the server. Now we have problem here, how does a thread group knows which user request to make ? more over user request can be FTP request or HTTP request or SOAP request. The answer is quite simple Samplers, using samplers we can define what kind of request has to be simulated using JMeter. Apache JMeter supports various types of samplers, lets go through each sampler in detail :
Continue reading JMeter Complete Element Reference – Part II