I am using JMeter for a real estate application when I am selecting a plot it is generating a dynamic value like this 1305003402565. It is incrementing like this 1305003280751 per request to request I need to capture this value and I am not able to find it in the source code.
You may be able to force your application to show the dynamic value in the source code by requesting the page as a GET (instead of POST). Then, using Tree View, copy the source into your favorite regular expression extractor to write your regex to extract the value.
Related
Hi i am working on project which was developed based on javasctipt. I have recorded the script and identified the dynic values but unable to find the boundaries of those dynamic values in previous requests and getting the boundaries in the same page request not in previous request. Due to this script is failing and i am unable to proceed further. Please some one suggest
Boundary Extractor requires zero knowledge but it's not the best option when it comes to dealing with HTML responses.
The best one I think is CSS Selector Extractor, however it's hard to tell anything without seeing the response you're getting (at least partial) and knowing what parts of it you want to extract.
See CSS Selector Reference for example queries
Currently I am working on moving some API DDT (data from CSV) tests from RobotFramework to Jmeter and what troubles me is the lack of proper JSONs assertion which is able to ignore some keys during comparison. I am totally new to jmeter so I am not sure if there's no such option available.
I am pretty sure we are using the wrong tool for this job, especially because functional testers would take the job of writing new tests. However, my approach (to make it as easy as possible for functionals) is to create jmeter plugin which takes response and compare it to baseline (excluding ignored keys defined in its GUI). What do you think? Is there any builtin I can use instead? Or do you know anything about some existing plugin?
Thanks in advance
The "proper" assertion is JSON Assertion available since JMeter 4.0
You can use arbitrary JSON Path queries to filter response according to your expected result
Example:
If it is not enough - you can always go for JSR223 Assertion, Groovy language has built-in JSON support so it will be way more flexible than any existing or future plugin.
Please find below the approach that I can think of:-
Take the response/HTML/json source code dump for the base line using "save response to a file".
Take the response dump for the AUT that needs to be compare or simply 2nd run dump.
Use 2 FTP sampler's to make calls for the locally saved response dump's.
Use compare assertion to compare the 2 FTP call response's. In the compare assertion, you can use RegEx String and Substitution to mask the timestamps or userID to something common for both so that it will be ignored in comparison.
Below I have shown just an image for my thought's for help.
You need to take care on how to save and fetch the response's.
Hope this help.
Please let know how to do correlation from below given code for FaxNumer whose value is "ctl02". This value "ctl02" will change depending on number of details added. The script is performing task of adding first an fax number to an account and then update it. So whenever we have to update a fax details it will be dependent on "test12345" from first line. "test12345" will be parametrized and its value will change everytime.
I have tried various option but not able to correlate it properly.
Kindly let me know in case more information is required.
Look at CSS/JQuery Extractor or XPath Extractor, both can work with parent/child associations and siblings.
If you aren't very familiar with CSS or XPath locators and need assistance in developing appropriate expression update your question with some more lines of HTML code around.
I'm looking into the possibilities of jmeter, and it looks just great. However, one of the things my testing script should be able to do, is search for some values, and click on a random resulting link.
So what I would need to automate is:
Entering the values in the searchbox (I could do this by using the correct GET url in a second page, but how do I do this 5000 times?)
Clicking on one of the results listed.
Thanks for the help!
This can be done using the CSV Data Set, it loads a CSV file, and feeds the content into the variables of your choice:
http://jmeter.apache.org/usermanual/component_reference.html#CSV_Data_Set_Config
After that, you can use the regular expression extractor to extract the URL's you want from the resulting HTML, and follow those links:
http://jmeter.apache.org/usermanual/component_reference.html#Regular_Expression_Extractor
You could use a HTML Link Parser for your second part (the clicking on one of the results):
http://jmeter.apache.org/usermanual/component_reference.html#HTML_Link_Parser
See http://theworkaholic.blogspot.co.at/2009/11/randomly-clicking-links-in-jmeter.html for an example of using the link parser in a context similar to your question.
I need to load test a service I've developed but I need the data that I post to the web service to have some variance.
I've set up Thread with an Http Request and I've the parameter I need to set but I can't see how I'd go about changing the contents of the HTTP parameter from request to request.
Ideally I'd like to feed in a list of data Items and have JMeter iterate through them.
Prepare kind of csv-file with list of your test-params and use it to parametrize your test-samplers, using at least the following:
CSV Data Set Config
Explained example here, simple example here.
Jmeter functions: __CSVRead, __StringFromFile.
Variables From CSV sampler from jmeter-plugins.
One way would be to prepare a CSV file with all the values that you will need. There are a multitude of different ways to use it afterwards. Alies Belik's answer listed most of them. The drawback of the CSV approach, however, is that you need to generate the list of values, and in some tests you can't simply reuse it without cleaning up/reinitializing the back-end database.
Another option are the functions for generating random values, usually paired with "User Defined Variables" controller.
__Random for generating numbers in a given range.
__RandomString for generating random strings of a given length and containing a set of characters.
This is a powerful mechanism, but I find it somewhat cumbersome and clunky.
For simple variables, like generating username/password/e-mail combinations, I prefer and find it easier to use the Random Variable config element. It's available since Jmeter 2.3.3. You add it to your thread group and specify a variable to store the random value for each thread. You can later reference this variable in your HTTP sampler, in the GET/POST parameters of the request, by specifying the Value of the parameter to be testuser-${rnd} for username, testpass-${rnd} for password. Each thread will get a different value of ${rnd} so there is a small chance (but there is still a chance) that you will get duplicate values (users).
Besides the functions mentioned in #zorlem answer, You can also use:
__UUID for generating a pseudo random type 4 Universally Unique IDentifier, if you need to generate random & unique strings.