In Jmeter, I am doing a search and every time it generates a context id,a search id and a session id. I managed to get the session id from the HTTP request and then pass it to the api call. But I don't see context id and search id anywhere and I am not able to pass it to the api. What can I do to get them?
From the chat, we learned that it client generated value.
suggested to use following links to solve the issue, by generating random string/int/alphanumeric/uuid etc. based on the data:
For Random Int: http://jmeter.apache.org/usermanual/functions.html#__Random
For Randome String (alphanumeric) : http://jmeter.apache.org/usermanual/functions.html#__RandomString
For Random values, defined by you: http://jmeter.apache.org/usermanual/functions.html#__RandomFromMultipleVars
For random UUID: http://jmeter.apache.org/usermanual/functions.html#__UUID
the function you choose, depends on what type of data that you are sending.
Related
My line o thinking is this:
get evaluations //would retrieve all evaluations of the system. (in practice never used).
post evaluations create a new evaluation
Following the Rest pattern
get evaluations/1 //details of the evaluation with id "1"
But I was using
get evaluation/{product_id}
To retrieve all evaluations of a product.
For what I know of Rest design this is not good. It would be something like this:
evaluations?product_id=5
Now, what it would be an endpoint to retrieve all reviews of a specific client? I am using Auth 2.0.
I am really confused.
Is it possible to shove it all in one controller?
In summary, I would like to know if the endpoint evaluations?product_id=9 is suitable to retrieve all evaluations of a product. And what would be and endpoint to retrieve all evaluations of a client that has a token.
You have many approachs here:
Separate Endpoints:
Suche as:
get /users/{user_id}/evaluations
get /products/{product_ID}/evaluations
get /evaluations/{evaluation_id}
single endpoint
get /evaluations/{type}/{id}
And in your controller implement a logic to retrieve evaluations according to the type (user, product,...) and the id of the selected type.
Personally, I prefer the first one.
I want to get share count for a particular url from Google Plus.I tried by passing activity id in Activities: get to get share count. It is working fine but I want the same by passing only url alone.
In Facebook I passed only the Url as input in query url with input url and i got share counts for an url.Is there any ways available in Google Plus to get the share count by passing only url.
Referred site:
jonathanmoore/gist:2640302
Welcome to the world of Google APIs. The method in question
Activites.get
GET https://www.googleapis.com/plus/v1/activities/activityId
Takes a single parameter
activityId string The ID of the activity to get.
This is how this method works you must pass an activityId to it you can not pass a url. I can suggest running an Activies.list first in order to find the activity you seek.
You're best option is to use the Search API. Use the URL as the search term and page through all of the results until no more are found. You then have a number for how many times the URL has been shared publicly on Google+.
I am trying to apply load sample request is like
http://54.174.110.64:8080/adserver/html5/inwapads/?adFormat=preappvideo&ak=O4DCX2&version=1.0&adu=5&cb=1494853894218&output=vast&priority=1&size=[vdo_adSize]&pageURL=http://qa.vdopia.com/qa/Ruchi/ssp_preroll1.html?0.7888977&domain=vdopia.com&refURL=&category=[CATEGORY]&siteName=vdopia&displayManager=Vdopia-SPP-Web&di=[COOKIE_ID]&dif=fpcm&sex=[GENDER]&age=[AGE];ipAddress=203.122.9.130;di=abcdefghijklmn
I have single request, what I want is that same request should have unique di (last key in query param). Nothing else I want to change.
My test is based on unique di in request keeping other parameters constant.
You can use Random function.
Hint:
I would suggest using __UUID() function which will generate a GUID structure which is unique according to the underlying algorithm each time being called.
If you don't like dashes you can remove them via __groovy() function like
${__groovy("${__UUID}".replaceAll("-"\, ""),)}
Demo:
See Apache JMeter Functions - An Introduction to get started with JMeter Functions.
I have used below approach :
ad di=${di_random}in path of HTTP request
I am very new to Jmeter and trying to use it for doing load testing my application.
In my application, every time we click on a template, application will allocate a unique id which to the template...when I recorded the steps using jmeter, a particular unique id was recorded...but when I tried to play the recorded case...it is looking for the same unique id....how do I tell jmeter to get the new id from the application?
Here are the steps
Login as a user,
click on a particular link,
click on a button which will then popup a window asking to select a template,
After selecting a template, my application will create a unique id for that template
It very much depends on whether that template ID is created on the client (i.e. by JavaScript), or on the server (i.e. you can actually record a template ID returned by the server).
If second is your case, then server returns template ID in the response to template selection, so you can use one of the post-processors - a supporting element invoked after the parent request; it usually extracts data from the response and saves it as a variable(s). In your case you'd extract template ID and save it as variable. Later samplers can use the variable in format ${your_name} instead of the recorded hard-coded string. So in that case your plan could look like this:
Which post-processor to use and how to use it depends on the response you are receiving form the server, so cannot be more specific here.
If the first option is your case (JavaScript on the client generates template ID; and your recording only contains usage of said ID), then you can simulate what JavaScript is doing by generating a similar ID using one of the JMeter script-related features: it could be random function, an inline piece of JavaScript code, a scriptable sampler, such as JSR223 Sampler, or... There are many options really, depending on concrete needs of that generated template ID. Again, a more specific question would help to narrow down your choices.
Classic "correlation" example.
Look for that generated ID in the previous responses (you can do it with the View Results Tree listener)
Once you detect it you need to extract it and convert into a JMeter Variable with a PostProcessor (the most commonly used is Regular Expression Extractor, however depending on the nature of your request you may consider to use others
Once you get the ID extracted and stored in the variable - substitute hard-coded value obtained via recording with the JMeter Variable
Repeat steps 1-3 for any other dynamic parameters or values. Or, consider a faster way of creating a JMeter test via alternative recording solution which performs the above steps automatically so you won't have to worry about detecting and handling dynamic elements. See How to Cut Your JMeter Scripting Time by 80% article for details.
You need to check response of the previous request. Normally ID will be created and can be found in the response of previous request and you can use that ID for next request.
You need to first find in which response the ID is being generated and the format of the ID. You can use firebug to see the response in HTML format and find where the id is.
Once you have the format of the id, create regular expression around it. Test it using regex tester that comes with JMeter. Or you can use rubular.com to check the correctness of your regex.
Once you have correct regex, use regular expression postprocessor on the request which returns the id and then use that variable in actual request that uses unique id.
Scenario: I am recording a script which is fetching values from CSV name and email. I have used ${email} and ${name} at the time which candidate is registering. Every time candidate register, unique instance Id is generated on the basis of which further action is performed.
Ex:
Candidate registers -> Unique Id (say 12345) -> ST : Start some test
on the website -> Some responses saved for 12345 -> FT : Finish test
on website
Need to perform the same for say 500 candidates. I am fetching unique email and name from csv.
How do i store/handle unique instance Id for each candidate dynamically and perform the entire operation?
Currently each operation is getting performed for same unique instance Id (12345) with 0% error.
Let me know if any other details needed for the same.
UPDATE from comments:
I can use say UniqueId whenever candidate registers using a RegEx Extractor or a XPath Extractor and i can pass that value in further process.
Now issue is i have to pass the stored variable in JSON.
No clue about that.
Since you've extracted UniqueId value using any extractor component it's stored in jmeter variable (pointed in the extractor's configuration) and can be referred as e.g. ${uniqueId}.
To pass into the further request you can use HTTP Request where in Post Body you can set your JSON request code with ${uniqueId} inserted in the right place.
You can use regular expression extractor in jmeter to extract required variable value and store reference it with a variable name .
Later it can be used in later requests by usin ${variablename}
In the regular expression extractor you can use perl5 regular expressions
Refer to this link for additional information:
http://www.jmeter4u.com/2013/04/chapter-6-handling-dynamic-server-values.html