Showing posts with label Jmeter. Show all posts
Showing posts with label Jmeter. Show all posts

Sunday, August 28, 2016

When using Jmeter I have come across two easy ways to record Jmeter scripts. I will explain these methods and the some tips to make your reording more usefull.

1. Using  blazemeter plugin.

This is a browser plugin that can be used to record Jmeter Scripts. Note that you should have a account created in blazemeter website for this and account creation is free. You can get the plugin for chrome from here.

After Installing the plugin, setup the plugin as shown below and start recording perform the action you want to record in the browser and stop the recording.  After stooping the recording you can download a .jmx file and open it with Jmeter.








2. Using Recording Controller

This is Jmeter inbuild option that is available for recording. To record with Recording  Controller follow the below instructions.

1. Create a Proxy server in the browser. To do this open Browser options and do the following configurations. Note that I'm adding localhost as my proxy host so I should access my website which needs to be recorded through the same domain "localhost".



2. Now right click on the WorkBench and add a "HTTP(S) Test Script Recorder" which can be found under non test elements and set the following configs. Make sure that the proxy port matches the proxy port that was set in step 01.



3. [OPTIONAL] Now add URL exclude patterns as shown below. This is to avoid Jmeter from recording unnecessary HTTP calls. (e.g: Loading javascripts/ Server Pings etc.)


4. [OPTIONAL] Now add a User Defined Variables Element and add any variable you might want to parameterize. What ever variable added here, if the value defined for the variable matches with any content of the recording, Jmeter will automatically parameterize this. This is quite handy when dealing with complex recordings. Make sure this resides in the same Thread group where the Recording Controller is located.



5. Now add a Recording Controller with the project. You can observe this in the above screenshot.

6. Now Start the proxy server and acess the browser and navigate to the website you want to record. Now expand the recording controller and observer the magic happening.

So that's it hope this might help someone, and please drop a comment if you have any other queries.

Wednesday, June 8, 2016



One of my friends wanted to access the cookie data that was generated from the cookie manager in Jmeter. So I googled a lot and couldn't find much information to achieve this. So in this post I will explain how I got this soloved.

Note : I tried to do this with a Regular Expression Extractor without any lick. It oesn't provide a option to access cookie data.

So the Simplest way I could do this is by using a JSR223 PreProcessor. Same thing can be achieved with a BeanShell preProcessor as well.

So Fist we need to access the current sampler context. This can be done by ctx.getCurrentSampler() and then lets get the cookie Manager. ctx.getCurrentSampler().getCookieManager().get(0) Note that you have to parse the index to the get method to get the cookie and I have passed 0 here. So the full syntax will look like following.


String cookie = ctx.getCurrentSampler().getCookieManager().get(0).toString();

Now lets assign this value to a Jmeter variable. This can be done in the following manner.


vars.put("jsessionid2",cookie);


The full Sampler will look like following.



So that's it, After getting the Cookie data you can perform any operation of the extracted string. Please drop a comment if you have any other queries.


Subscribe to RSS Feed Follow me on Twitter!