I want to create a script in JMeter that simulates e.g. 100 users accessing our site over a period of 3-4 minutes.
We need to test whether our application can allow 25.000 users/day - that is 1.100 per hour.
For that i have made this Jmeter test:
and here is the result
and here is the graph
I want to know what this result is exactly telling us, if my test pass or fails, if yahoo.com (for which we have run this test for our example) can allow 25.000 users/day and if i am inputting my criteria / requirements correctly?
Thanks
1. I would advise to use better some custom samplers from jmeter-plugins instead:
Ultimate Thread Group: more flexible implementation of Thread Group allows to setup your load-testing scenario exactly how you want;
Response Times Over Time / Response Times vs Threads / Active Threads Over Time listeners: more demonstrative graphs as JMeter's default ones.
2. In addition to the #Qwe comment above: test not the single HTTP request but user's transactions: each test-thread should simulate a kind of real-user browsing activity: login (if any), navigating through the site, search, accessing/editing personal settings, logout, etc.
To emulate real-user add also "think-time" timer between transaction steps.
3. Control responses, at least the following:
response code of each user's request (# Response Assertion);
duration - to verify non-functional requirements for critical transactions (# Duration Assertion).
4. Look into corresponding JMeter documentation:
My boss wants me to load test our web app!
JMeter Wiki
5. Some step-by-step guidelines about Jmeter setup and usage for load-testing you can find here:
Load Testing your Applications with Apache JMeter
Using JMeter
Effective load testing with Apache JMeter
Load Testing with JMeter: part 1, part 2, part 3
A Simple Load Test with JMeter
Load Testing with Apache JMeter
Performance testing with JMeter
Your First JMeter Test
Some thoughts on stress testing web applications with JMeter: part 1, part 2.
UPD.
Please find, use and feel free to extend this Awesome JMeter collection continued on github.
Related
I'm thinking on solution to automate client-side using Lighthouse or PageSpeed Insights in JMeter.
With PageSpeed Insights, using requests like
https://pagespeed.web.dev/report?url=%2F&form_factor=mobile
https://pagespeed.web.dev/report?url=%2F&form_factor=desktop
it is possible to get web-page which contains client-side metrics and parse out their values to variables:
URL_First Contentful Paint (FCP)
URL_First Input Delay (FID)
URL_Largest Contentful Paint (LCP)
URL_Cumulative Layout Shift (CLS)
URL_Speed Index
URL_Time to Interactive
URL_Total Blocking Time
...
i.e. URL_metric - as variable name, where both URL and metric could change.
The question is, if I want to see the results statistics in JMeter "Summary Report" or "Aggregate Report" view for each combination of URL and metric, what is the best way to pass these variables names (URL_metric) as Label in JMeter?
You could dump the saved values to a file in usual JMeter output format (JTL):
{timestamp},{duration},{sample_name},200,OK,thread_group_name 1-1,text,true,,0,0,20,65,null,0,0,0\n
Curly brackets denote placeholders.
You already have durations and sample names, timestamps do not matter in your case since you only wish to have aggregated results.
After saving the data to a file you could open it with Summary Report or Aggregate Report.
In order to get client-side metrics you will need a real browser, as per JMeter project main page:
JMeter is not a browser, it works at protocol level. As far as web-services and remote services are concerned, JMeter looks like a browser (or rather, multiple browsers); however JMeter does not perform all the actions supported by browsers. In particular, JMeter does not execute the Javascript found in HTML pages. Nor does it render the HTML pages as a browser does (it's possible to view the response as HTML etc., but the timings are not included in any samples, and only one sample in one thread is ever displayed at a time).
So in order to get client-side metrics from JMeter you need to kick off a real browser, for example take a look at WebDriver Sampler which provides JMeter integration with Selenium browser automation framework, check out Mixing Selenium Into Your Load Scenario for more details.
Once you have the metrics you can store them into JMeter's Sample Variables and plot them in custom charts of the HTML Reporting Dashboard
I am first time using gatling and I am stack with such task
I need to provide working code of the following scenarios: dont know how to describe logging in/out
Basic flow: user1 is login in > continue to landing page > navigating through pages
Flow2 : user2 which is already logged in is downloading some pages
Flow 3: user1 and user2 are logging in and out for about 500 time each during 10 minutes.
You can use "Scenarios" and "Chain" them.
Each flow you are mentioning will become a scenario.
To give you a hint:
Start with defining User Requests: for e.x.: Login, Logout, Go To Landing Page, Navigate Some Pages, Download Something etc.
val loginRequest = exec(http("Login").get(...))
Then define Scenario like:
val basicFlow = scenario("My basic flow").exec(loginRequest).exec(browseRequest).exec(logout)
val flow2 = scenario("My 2nd Flow").exec(loginRequest).exec(browseRequest).exec(downloadRequest).exec(logout)
Then you can chain your scenarios in Simulation/setUp like:
setUp(basicFlow(injectAtOnce(1)), flow2(rampUsers(20) over (3 minutes))
You can then improve the load (setUp method), loop your requests etc.
The Gatling Documentation is a good place to start. The following pages will help elaborate more on what I explained briefly above:
More about Scenarios and Control flows like repeat etc.
Simulation and Load setup
If all this seems overwhelming, I would suggest start your record your individual scenarios and then refactor the generated code.
Once you are familiar with the concepts, you can try their helpful Cheatsheet
Edit#1
Gatling has restructured their documentation, updated the links. Please note that the code is as of Gatling 2.0.3, current version is 2.3, so it might not work out of the box, but the concept remains the same.
I am new to Jmeter testing. Last day my client asked me to test his website for load. I did a normal testing on it but now he wants a scenario where,
"I need to post both text & images with max no of concurrent users.
And also please do monitor the resource usage like how much Ram, CPU & Bandwidth consumption."
I need to find out how many active users can use the site cucurrently.
I referred this, JMeter - File upload and file download scenario but still I am not clear about it. May be because I am new to it.
But I need to login to the URL inhouse.net/redmine
Then I should go to the Home page inhouse.net/redmine/home
and the update profile photo there
How can I do this through jmeter?
Can someone please help.
Thanks!
Shari
Get the newest JMeter version from the site, and get JMeter plugins (Extras with Libs Set) from here. Once JMeter and the plugins are installed, you should take your time and read these:
JMeter user manual
JMeter best practices
About performance testing
The third one is really long, it should give you every detail on performance testing, use it only if something is not clear.
Then, you have to record your test steps (the http(s) requests from your browser that you want to simulate), a good guide on that is here.
For the scenario, I'ld use the ultimate thread group from JMeter plugins pack, and slowly increase the number of users from 1 to 1000. Measure how much time does it take for 1 thread (user) to complete the test steps. For example if 1 user takes 1 minute to finish, I'ld start a new thread every 1 minute, up to 1000. (check out timers for this).
You'll have to establish some KPIs, that reflect your needs, (in your case it's upload successful) check out the MSDN guide for more details on this. You'll have to implement these checks in your jmeter scenario (profile) using assertions, to determines if an upload was successful or not.
Don't forget to run your final test in command line mode. (with the -n paramter, no GUI)
For resource usage monitoring I recommend using dstat.
I wrote test case using selenium webdrive. also i use junit.
Now i want to test that test case for 100 + users.
So i use treads in that application, but i can go up to that much of users because my memory in not enough for that(open 100+ browsers).
So is there a way to test this in Jmeter.
I can't use badboy recording and import it to Jmeter because somehow my application doesn't support it. (the replay doesn't work in badboay).
Please help me to solve this problem.
Thanks
JMeter offers it's own recording solution - HTTP(s) Test Script Recorder. You can record your test case with it and then try to replay.
If you need to check only unauthenticated navigation, like accessing different pages by anonymous user it should work as a charm. However if you test assumes authentication (log in), creating or updating some stuff, etc. you may need to use HTTP Cookie Manager to deal with user authentication and Regular Expression Extractor Post Processor to fetch dynamic values from responses and add them to next request.
There are some more components you may wish to consider adding to make your test look like more realistic:
Add HTTP Header Manager - to set different headers like User-Agent, Accept-Language, etc. - what real browser does
Add HTTP Cache Manager - to simulate browser cache
Make sure that "Retrieve all embedded resources" property of HTTP Sampler is checked - to simulate parsing css, images, scripts, etc.
Make sure that "Use concurrent pool" is enabled and has size from 2 to 5 threads - as browsers download embedded stuff asynchronously in several threads
Make sure that you filter out external domains in "URLs must match" field - you unlikely want to load test Google Analytics or external banners or whatever
I'm a newbie to jMeter, so please bear with me.
I've been assigned the task of testing how an e-commerce website responds under load. I've managed to set up basic tests in jMeter that basically just repeatedly visit the home page, but I'd like to simulate something a bit more realistic:
User arrives on home page
User goes to catalogue page
User views product
User adds product to cart
User returns to catalogue, selects another product, adds to cart
User removes first product from cart
User proceeds to checkout
User completes checkout process.
I'm having trouble finding adequate documentation to explain how to do this. I figured out that I need a cookie manager in my test so that the user session will be maintained, but I haven't figured out how to get the user to traverse the site in a realistic use pattern (such as the one described above). Can anyone help out with this, give me some pointers as where to look for good examples, etc?
This should be no problem, record or manually create the necessary steps as HTTP Samplers, then add them into a Runtime Controller for example to execute them iteratively.
The individual steps will be executed in the order they are in the tree and, in case Cookies are used to handle session state, you might need to add the Cookie Manager to the top of the tree which will handle cookie headers for each user.
Add some timers to simulate user's think time and scale up by increasing the number of virtual users in the thread group.
Use some listener like the Aggregate Report to view the response times for every step.
Try to read http://jmeter.apache.org/usermanual/index.html at first.
Also you'll encounter the problem that Jmeter can't process dynamic pages:
http://wiki.apache.org/jmeter/JMeterFAQ#Does_JMeter_process_dynamic_pages_.28e.g._Javascript_and_applets.29
Does JMeter process dynamic pages (e.g. Javascript and applets)?
No. JMeter does not process Javascript or applets embedded in HTML pages.
JMeter can download the relevant resources (some embedded resources are downloaded automatically if the correct options are set), but it does not process the HTML and execute any Javascript functions.
If the page uses Javascript to build up a URL or submit a form, you can use the Proxy Recording facility to create the necessary sampler. If this is not possible, then manual inspection of the code may be needed to determine what the Javascript is doing.