Multiple http requests that has different URLs and data - concurrency

I have a scenario to check out where my web application can sustain how many concurrent user registrations. Every user registration URLs and their data are unique. How can I simulate this using JMeter? I have the registration URLs with me.

There are different ways of parameterizing your JMeter test using external data and the easiest / most commonly used one is storing your test data like URL into a CSV file and using CSV Data Set Config to "feed" JMeter with the data from the CSV file.
Assuming you have test.csv file in "bin" folder of your JMeter installation which looks like:
URL
http://example.com/register/user1
http://example.com/register/user2
http://example.com/register/user3
etc.
Add CSV Data Set Config to your Test Plan and put test.csv file into "Filename" field
In the HTTP Request sampler put ${URL} JMeter Variable reference into "Path" field. You can also change HTTP Request sampler name to be something like Register: User - ${__threadNum}, URL: ${URL} in order to be able to distinguish requests for different users
Set "Number of Threads" to whatever value you need in the Thread Group
Add View Results Tree listener to your Test Plan and run your test - you will see that each virtual user is picking next line from the CSV file:

Related

How can I decode the http encrypted cookie in Jmeter

I am now using Jmeter to prepare a test plan for my web. The rough flow of the script is that I can check my profile after login. I tried to run my recorded script, and found that the cookie is encoded in http format which I don't want it to be.
Therefore, I would like to ask is there anyway so that I can have a not encrypted cookie value?
[I applied a cookie manager in the script.
The value of the cookie now is something like "%22mh8eIAH8rfsZsM3r%22".
The value that I want is something like "mh8eIAH8rfsZsM3r"]
%22 means " which is percent-encoded, if you want to decode it back - take a look at __urldecode() function:
In general you should not be recording any cookies, you need to add a HTTP Cookie Manager and JMeter will automatically extract incoming cookies from Set-Cookie response header and add them to the next request as Cookie header if domain and path match the ones in the cookie, it's not expired, etc
If you need to access the cookie value as a JMeter Variable the easiest way is adding the next line to user.properties file:
CookieManager.save.cookies=true
and upon JMeter restart you will be able to use the cookie value as ${COOKIE_your-cookie-name-here}
More information: HTTP Cookie Manager Advanced Usage - A Guide

How to extract Cookie from Request Body of View Results Tree in JMeter ? I want to save them to CSV File to use in future

In My application the login page is very slow such that when I perform load test its breaks even before going to the main page. For that with few login credentials and by iterating them I need to generate new cookie everytime and store all of them in .csv file so that in near future I can just use cookie to login and load test won't break.
Request Body has
Cookie Data:
cb=k3fp7s1rnjoil48ep8aeilro64; lang=en_US
Add the next lines to user.properties file (lives in "bin" folder of your JMeter installation)
CookieManager.save.cookies=true
sample_variables=COOKIE_cb
Restart JMeter to pick up the changes
Add HTTP Cookie Manager to your Test Plan
Add Flexible File Writer to your Test Plan and configure it like:
That's it, when you run your test next time you will see a new file called values.csv holding the cookies for each thread (virtual user), each cookie on the new line.

How to get Cookies from response header in jMeter

I am trying to get the cookies from a GET request when I first access a website via HTTP Request, there are a number of suggestions that suggest using user.properties files e.t.c. but I do not actually have these available as I am using the jMeter GUI to build the tests and it doesn't create these files.
Is there a way of getting the cookies from the header without the user.properties. Or if not, please could I request some detail as to how to achieve creating a user.properties file e.t.c. as I am very very new to jMeter.
Thanks in advance
For a simple caching you just need to add to Test Plan HTTP Cookie Manager and HTTP cookie(s) will be added.
user.properties is used for specific cases, and it is already exists in your JMeter bin folder in case you will need to update it.

jMeter Cookie Manager doesn't store all cookies

After reading documentation and posts in Internet I still cannot solve the problem with Cookie Manager in jMeter.
I got sid ID in response header but it is not stored in my cookies manager.
Below are the screens of my test plan and response with connect.sid
Could you help to figure out what is wrong?
Response with cookie
Cookie is not stored
In order to be handled by JMeter (and web browsers as well) your cookie needs to be compliant with some policies i.e. domain and path should not clash with the current URL, expiration date should not be in the past (your cookie expiration date is 20:33, looking into the time at your machine you have 23:21), etc.
Also your set-cookie header name looks suspicious, I used to see it with first capital letters like Set-Cookie
Suggestions:
Try out different "Cookie Policy" options:
Add the next line to user.properties file (lives in JMeter's "bin" folder)
CookieManager.check.cookies=false
Points 2 and 3 don't help you can get some extra information by enabling debugging output by adding the next line to the aforementioned user.properties file:
log_level.jmeter.protocol.http.control=DEBUG
and look into jmeter.log file for anything connected with CookieManager, HC4CookieHandler or HC3CookieHandler
As a last resort you can always get any cookie value using Regular Expression Extractor, the relevant configuration would be something like:

How can i perform a GET request from a separate php file to a uri in my cakephp platform

I'm new with cakephp and I've just finished putting my controllers, models and views in place.I am able to get information from my database through the browser, but i want to achieve this using a seperate php file where i perform a get request. How can i perform a GET request from a separate php file to a uri in my cakephp platform?
I am not sure if this is what you want to accomplish but,
If you want to get the output of your views from another php file (script?), you could use file_get_contents($url), where $url is the uri to your cakephp app.
Hope this helps
If I understand what you mean: Its pretty easy.. add params to the end of your uri: like this yourdomain.com/controller/action/99/foobar
This adds an id and some random param which you can use in your controller with the code below... Just add them as params.
function action($id,$param2){
// use params here
}