When I record a script in Jmeter I get hundreds of samplers that I don't need.

How can I identify which samples can be deleted without impacting the script functionality?

3 Answers 3


You need to refine your scripts for the unwanted requests as per below mentioned ways

  1. First you should exclude all the static content (like CSS, images, js files, .properties files, .ico etc.) from your recording, as requests for these samples should be from cache and keeping these requests will only make your script lengthy and heavy. So, in your HTTP recorder there is an option to Exclude unwanted samplers, just add all those extensions which you want to exclude there and they will not be recorded.

When you use this Exclusion, most of your unwanted requests/samples will get reduced automatically and instead of hundreds of request you will see few requests.

  1. If your application is communicating to other application/URL through some plugin or other way round, then you need to delete those requests from your recorded script. Just look at the URL which is being called from sampler detail, if that URL does not belong to your application (i.e. IP/domain name is different from yours) then delete such samplers e.g. call being placed to facebook, twitter, some live-chat support plugin.

  2. You need to keep only those HTTP requests which are calling/hitting your application GET/POST method for either posting your request with some parameters and getting response from the server. Any request which is neither posting anything or not getting any response from the server should be deleted. For this too you need to verify samples from their detail.'

When using step 3, first try with 'Deactivating' the samples, if your script works after deactivating then delete those deactivated requested. This is just a backup plan, in case your script doesn't work after delete or you delete some required request by mistake then by using Deactivating method you can still get it back and make your script working. It is just to avoid some rework (else script need to be re-recorded), Once you get used to this process you can directly go with the delete sample step, instead of first making it inactive and then deleting them.

  1. Another method is not to go by recording process, just add blank HTTP samplers to your test plan and then modify your URLs/requests which are actually needed, but for this process you need to have in depth knowledge about the application and which methods are called for performing a feature e.g. for saving a record you need to add the samplers for 'Add', 'View' and 'Save' functions. This method of creating script is bit tricky and time consuming in initial phase but then you don't need to record and then delete samplers.
  1. Exclude all the external domains which are not related to the web application you're testing. I.e. if it displays map from Bing - remove this sampler, if application plays video from Youtube - remove it as well as you ain't gonna need it. See Excluding Domains from the Load Test guide for details on how to filter out unwanted domains.

  2. If you open File -> Templates -> Recording in JMeter and look at the HTTP(S) Test Script Recorder configuration, you'll see that some content types are being excluded from recording, e.g. bmp, css, js, gif, etc.

JMeter PRoxy

So if you replicate this configuration - requests to these images will be filtered out.  

Actually it is not correct to completely remove these requests as real browsers:

  • download all these "embedded resources" like scripts, styles, etc.
  • do it only once, on subsequent requests resources are being returned from browser's cache

So "good" configuration would be:

  1. Excluding images, scripts and styles from recording
  2. Configuring HTTP Request Samplers (better via HTTP Request Defaults) to

    • Download Embedded Resources
    • Use concurrent pool of 2-4 threads for it
  3. Add HTTP Cache Manager to replicate browser's behaviour w.r.t. embedded resources.

You can add unwanted URL patterns to exclude in HTTP Test Script Recorder. I have written about this concept here with examples.


The important thing is to use the Test Recorder fields URL Patterns to Include and URL Patterns to Exclude.

In Patterns to Include, use .*\.html unless there are specific pages you need to exclude.

In Patterns to Exclude, use (?i).*\.(bmp|css|js|gif|ico|jpe?g|png|swf|woff) to avoid recording style, image, font, and animation files.

The patterns are Regular Expressions, so you can improve your filtering by learning more about regular expressions and how they work

  • Hi, Rajesh, your original answer would probably have been deleted as a link-only answer or spam. I expanded it with information from your blog post and made it a bit clearer that it is your post.
    – Kate Paulk
    Jan 20, 2017 at 13:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.