Load testing with Jmeter and selenium plugin - selenium

I'm looking to perform a browser based load test on my application. I was looking this option to use selenium plugin with Jmeter. So that I can write the required UI flow with Selenium within Jmeter and parameterize using Jmeter options.
I've used Jmeter for http/https request with 400/500 concurrent users.
Is it possible to use Jmeter + Selenium plugin for a browser level load test with around 400/500 concurrent users?
Thank you

Theoretically yes but you will need to think about the hardware.
As per Firefox 102 System Requirements one browser instance needs:
1 CPU core
2 GB of RAM
so for 500 browsers you will need at least 501 core and at least 1001 GB or RAM so most probably you will have to go for Distributed Testing
Also as per WebDriver Sampler documentation:
Note: It is NOT the intention of this project to replace the HTTP Samplers included in JMeter. Rather it is meant to compliment them by measuring the end user load time.
Also as per Selenium documentation
Performance testing using Selenium and WebDriver is generally not advised. Not because it is incapable, but because it is not optimised for the job and you are unlikely to get good results.
So I think you need to conduct the main load on HTTP protocol level and use 1-2 instances of real browser for frontend (client-side) performance testing.

Related

Load Testing with Selenium? What are the alternatives for my situation

Currently I'm trying to run a load test which walks through a uniquely created URL. I know JMeter is often used for load testing, but I was specifically asked to do it through something like Selenium that uses real browsers to create the URL then open that URL and complete the steps within the URL. I have created a Selenium script that can easily do this, but I need to do this 100 times concurrently and can't find a good way to do.
Is there a way to do this? I've looked into Selenium Grid but I'm not sure if I even have enough nodes to run 100 browsers concurrently. Please if you have recommendations for software or a different method of doing this I would love to hear it. Thank you!
JMeter can be integrated with Selenium using WebDriver Sampler so you can re-use your code and rely on JMeter's multithreading capabilities.
If one machine won't be powerful enough to kick off 100 browsers - you can consider going for Distributed Testing
In general be aware that browsers don't do any magic, they just send HTTP requests, wait for responses and render them. JMeter is not capable only of rendering the page, but if you need to load test the backend - it can mimic browser's network footprint with 100% accuracy, just make sure to configure JMeter accordingly in order to behave like a real browser
JavaScript execution time and page rendering speed can be checked either using single WebDriver Sampler or a separate solution like Lighthouse

Performance/Load test using selenium webdriver prerecorded steps

I have been using selenium webdriver as my main method to do functional tests. So far its been working greate with our product.
I need to do some performance and/or load tests on the website, I was wondering if there is a tool that would incorporate my selenium tests or a tool which i can use with the recorded tests as the base.
Currently i am using selenium webdriver with C#
Any help is appreciated.
Given you have tests written in C# the most obvious way would be using Visual Studio Load Testing capabilities.
If you are looking for a free and open-source solution I would recommend going for Apache JMeter. JMeter has integration with Selenium via WebDriver Sampler plugin so you should be able to run your Selenium tests in multi-threaded manner. However you will need to convert your C# code into one of the WebDriver Sampler supported languages (default is JavaScript)
Remember that Selenium tests are very resource-intensive as real browsers consume a lot of CPU/RAM so the number of virtual users you will be able to mimic this way will be very limited. So recommended approach is creating main load on a HTTP protocol level and use one Selenium instance to check rendering speed while your application is under the load.
You can install WebDriver Sampler plugin using JMeter Plugins Manager.
Why do you need to run full browsers. HTTP layer tests are far simpler? You also should be looking at only a subset of business processes in performance which generate a preponderance of load.

How can i test 20000 users with live stream?

I need to test 20000 users watch live stream and need to capture screen after every 2 minutes. is phantomjs is good?
Please suggest a good way.
I would recommend the following combination:
Apache JMeter - to simulate 19999 users consuming the stream. Check out How to Load Test HTTP Live Media Streaming (HLS) with JMeter guide for details.
PhantomJS is quite good for simulating a single user so you can launch in in a separate thread to mimic remaining user and take screenshots, however most likely you won't be able to capture streaming content.
By the way, you can even integrate PhantomJS with JMeter, see Web Driver Tutorial and PhantonJS Driver Config

Jmeter recording in NON GUI mode for Selenium testing

I would like to record the network requests of a Selenium test. Rather than using jmeter GUI, I would like to automate this process in a script. The idea would be to run a selenium test and record it simultaneously. Is there a built in way to do this?
GUI Jmeter is ideally for development of scripts, which are then run headless to get true performance figures.
You can develop selenium webdriver tests as junit tests, which integrate to JMeter very easily.
Running a recorded Selenium IDE test would not be so straightforward, better to export it as Java Webdriver.
Make sure you follow junit naming conventions and annotations (depending which version you use). Write the test class, including junit 'test' methods, then create a jmeter test plan with a junit sampler, and configure the junit sampler to run your test method[s].
maven and plugins can be used to make it all run seamlessly in headless mode on any host.
Once you have developed one of these, it will be easy to review the jmx test script and automate the process of creating more jmeter tests, if that is what you meant by automating the process.
Start JMeter's Proxy Server
Configure your Selenium script to use JMeter as a proxy. See Using a Proxy guide for configuration details for each driver
Run Selenium test - all requests should be recorded by JMeter.
Add the next test elements to JMeter test plan:
HTTP Cookie Manager - to represent browser cookies
HTTP Cache Manager - to represent browser cache
follow recommendations from How to make JMeter behave more like a real browser to properly configure embedded resources retrieval, user agent, request defaults, etc.
Configure Thread Group parameters according to your load scenario.
Replay the test.
I expect that you will need to apply some correlation, but it may be not required.

Can i use my WatiN tests to stresstest?

In my current project we are testing our ASP.NET GUI using WatiN and Mbunit.
When I was writing the tests I realized that it would be great if we also could use all of these for stresstesting. Currently we are using Grinder to stresstest but then we have to script our cases all over again which for many reasons isent that good.
I have been trying to find a tool that can use my existing tests to create load on the site and record stats, but so far i have found noting. Is there such a tool or is there an easy way to create one?
We have issues on our build server when running WatiN tests as it often throws timeouts trying to access the Internet Explorer COM component. It seems to hang randomly while waiting for the total page to load.
Given this, I would not recommend it for stress testing as the results will be inaccurate and the tests are likely to be slow.
I would recommend JMeter for making threaded calls to the HTTP requests that your GUI is making
For load testing there is a tool which looks promising - LoadStorm. Free for 25 users. It has zero deployment needs as this is a cloud based service.
You could build a load controller for your stress testing. It could take your watin tests and run them in a multithreaded/multiprocessed way.
If you are comfortable using Selenium instead of WatiN, check out BrowserMob for browser-based load testing. I'm one of the Selenium RC authors and started BrowserMob to provide a new way to load test. By using real browsers, rather than simulated traffic, tests end up being much easier to script and maintain.