I am running jmeter to perform performance testing on a web application. The web application restricts the creation of the duplicate task. When I record that using blazemeter and run it with 100 threads, it shows that the task creation url is failed in the report, as it tries to create a task with the same name. How to avoid this?
In the majority of cases you simply cannot record and replay JMeter script without prior modifications as you need to perform correlation and parameterization.
In particular your case you need to identify the task id, most probably it is a parameter of a POST request and replace recorded hard-coded value with a JMeter Function which will generate a random value, i.e.
__Random() - for a random number in the given range
__RandomString() - for a random string from the given characters
__UUID() - creates a GUID-like structure with a very high chance of being unique, i.e. 123e4567-e89b-12d3-a456-426655440000
Related
I am creating a JMeter Test Harness that will be run from Jenkins using "Build with Parameters' to set runtime parameters that are passed into JMeter as Properties using -J attributes.
End users will be given the choice of running tests either based on the number of iterations or a period of time.
I can easily interrogate a passed in property value to determine if an 'iteration' or 'time' based test type and in order to try this I have added variables (which may or may not be have values depending) for ALL of the Thread Group 'Thread Properties' fields as can be seen below. Each variable will have a value of either 0 or 1+ depending upon the Jenkins parameters passed in at runtime.
enter image description here
As I do not want to create 2 Thread Groups (one for iteration based, and the other time based) then use logic controllers or similar to control what way to test, is there a dynamic way to switch the Thread Group 'Thread Properties" behaviour at run time using the singular Thread Group?
enter image description here
Any help in making 1 thing do 2 things in my little world of JMeter will be greatly appreciate!!
Not really, with "vanilla" JMeter you can:
Set number of iterations to -1 for "duration" based test
Set duration to a very long value (a couple of years) for the "iteration" based test
Other options are in:
JMeter .jmx scripts are basically XML files and XML is a subset of text so you can use a text editor like sed to substitute values directly in the .jmx file
Taurus automation framework has a nice feature of modifying an existing JMeter test before launching, it allows overriding absolutely any property of absolutely any element.
at the time of recording activity I am recording complete activity till place order, but when run the same action for 5 times, in result everytime its hitting same URL that has been generated while recording, but because of it place order not recording to my admin account.
In the majority of cases unfortunately you will not be able to successfully replay the recorded script because modern web applications widely use dynamic parameters for various reasons like client side state tracking or security reasons.
So you need to parameterize and/or correlate your test and replace recorded hard-coded values with either dynamic parameters which needs to be extracted from the previous response using a suitable JMeter Post-Processor or provide random values or use pre-defined values from i.e. external CSV file.
The easiest way of detecting dynamic parameters is recording your test one more time and comparing 2 recorded script - the parameters which will differ will require your attention.
You can also consider using an alternative recording solution which is capable of exporting recorded scripts in "SmartJMX" mode with automatic detection and correlation of the dynamic values, check out How to Cut Your JMeter Scripting Time by 80% article for more details.
Currently, I am recording a script in jmeter by which I am adding a record in a website , but a problem is that while recording a script I am able to add a record in a website, but once recording has been done and after that if I will run a script again then, a script is not adding a record in a website.
can you please help me with this?
In the absolute majority of cases you will not be able to replay the recorded script without performing correlation.
Modern web applications widely use dynamic parameters for session management or CSRF protection so once you record your test you get "hardcoded" values and they need to be dynamic.
Assuming all above my expectation is that your test doesn't add record due to failed login or something like that. Inspect requests and responses using View Results Tree listener - this will allow you to identify which exact step is failing.
The process of implementing the correlation looks as follows:
Identify the element which looks to be dynamic either manually inspecting request parameters and look for "suspicious" patterns or record your test one more time and compare the recorded scripts looking for the parameters which differ
Inspect previous response and extract the dynamic value using a suitable post-processor. For HTML response times the best option is CSS Selector Extractor. It will allow you to extract the dynamic parameter value and store in into a JMeter Variable
Replace hardcoded recorded value with the variable from the step 2
Repeat for all dynamic parameters
Don't forget to add HTTP Cookie Manager to your Test Plan.
I record and run the Jmeter script by keeping number of users = 1, in tread group.
Results tree output:
I increased the number of users to 3 and result tree output order changed.
Therefore my some of regular expression exacter logics get failed and resultant responses failed. How can I avoid this situation.
Is there way to manage result tree execution order.
If your regular expressions are under the requests and not at the same level as of HTTP requests then it should not be a problem.Every thread/vUser will run independently. But, in view results you will see request as and when executed by different threads and not in sequence.
As per JMeter Functions and Variables user manual chapter:
Variables are local to a thread
Each JMeter thread (virtual user) executes Samplers upside down (or according to the Logic Controllers). JMeter threads are absolutely independent from each other and each thread has its own variables.
So the problem must be somewhere else, inspect the state of the variables using Debug Sampler and the response data for /oauth calls - it might simply not contain the necessary token value.
Also there is a suspicious call to bundle.js, my expectation is that you should not be executing it directly. The good practices is to configure HTTP Request Defaults to download embedded resources and use parallel pool to be closer to what real browsers do.
See Web Testing with JMeter: How To Properly Handle Embedded Resources in HTML Responses article for more detailed explanation.
I have jmeter script contains five transactions of which one transaction contains more than one dynamic values. And I want to know how to decide which value to fetch in order to pass it to further transaction?
You need to fetch those values which are required.
Record your scenario 2 times
Inspect request details using View Results Tree listener
Find request parameters (they may be in the request headers as well) which are different between 2 recordings
These are the dynamic parameters you need to correlate (extract from the previous response and pass to the next request)
Alternatively you can use a cloud-based JMeter scripts recording solution which is capable of exporting recorded scripts in "SmartJMX" mode with automatic correlation of all dynamic parameters so you won't have to worry about it. Check out How to Cut Your JMeter Scripting Time by 80% guide for details.