When I record a plan many unwanted samples are generated which I don't want. How can I achieve this....? How to handle HTTP URL of all the samples. Say I will login and then after successful login view a graph by clicking on a drop down on the homepage. There are only 2 or 3 steps but while recording the plan some 20 samples are generated.
There are only 2 or 3 steps but while recording the plan some 20 samples are generated.
This is because when you record a test then not only your actions but along with that all the static content which is being used for completing your request gets recorded. So you will see lots of requests for images, style sheets, Java script files etc. in your recorded samples. JMeter by default record all these components until you tell it to exclude the same. So either you need to delete these not-required requests or you can exclude the same from recording.
Refer these links for how to exclude the requests: http://jmeter.apache.org/usermanual/component_reference.html#HTTP(S)_Test_Script_Recorder https://jmeter.apache.org/usermanual/jmeter_proxy_step_by_step.pdf
In additon to this, this question is almost similar to the question already posted
You can refer this question for more details on your question.
You can filter out "unwanted" requests which may include completely external resources like banners, images from 3rd-party websites, Google Analytics, etc.
It is recommended to remove such requests as external websites isn't something you can control and your test should focus solely on the application under test.
See Excluding Domains from the Load Test guide to learn how to efficiently filter out external resources.
In regards to best practices and what requests need to be made, I'm a strong believer of "reality" approach - load test should be as close to real browser behaviour as possible. So
- Browsers download "embedded resources" like scripts, styles, images, etc. - JMeter test should do the same
- Browsers download embedded resources, but do it only once - on subsequent requests aforementioned resources are being returned from browser's cache. So it is recommended to add HTTP Cache Manager
- Cookies are quite important for authentication, state-management, etc. Add a HTTP Cookie Manager to your test plan