Is it possible the use headless mode with 'Remote Driver Config' for selenium jmeter plugin - selenium

I'm following https://www.swtestacademy.com/performance-testing-jmeter-selenium-grid/ document and I'm trying to use chrome browser in headless mode with the Selenium Grid.
I dont find an option in 'Remote Driver Config' sampler to do that. How can I set up headless mode for remote driver? ( I'm planning to use selenium grid)

If you're "following" an external resource you should ask the question there, not here.
As of WebDriver Sampler 3.3 it is not possible, if you want to continue "following" the article you will have to switch to the JSR223 Sampler and Groovy language where you will have the full freedom of initializing the RemoteWebDriver and passing --headless and whatever else arguments you want to it.
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.
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.
so it looks like "following" the document is not the best idea and you should reconsider your approach

Related

How to use Testng Selenium Scripts in Jmeter

I have Testng Selenium Framework for functional testing, i have a request to reuse that for JMeter performance testing. Since I am new to Jmeter please help me in solving the problem.
It is not possible.
In JMeter we create and XML based jmx file for execution.
The selenium functional test cannot be imported to JMeter
Configure Jmeter recording proxy and run the selenium script. All traffic from the browser will get recorded in jmeter. Then, do the correlation and parameterization. For authorization, you authorization module in jmeter.
Also, check the below link for another way:-
https://www.blazemeter.com/blog/how-convert-selenium-scripts-jmx-converter/
Please note, I am assuming that you require jmeter load testing and not GUI based execution from jmeter.
Hope this helps.
To execute the selenium related scripts what you need is to configure the webdriver sampler in jmeter and its browsers, after configuration a slight modification is required in the scripts to execute using jmeter.
For reference see the below given link
https://jmeter-plugins.org/wiki/WebDriverSampler/

How to run headless browser in jmeter for WebDriver Samplers,

Detailed steps please, tried to use both HTMLUnit Driver Config and PhantomJs config, but no luck
How to run headless browser in jmeter for WebDriver Samplers, detailed steps please, tried to use both HTMLUnit Driver Config and PhantomJs config, but no luck. My requirement is I need to convert selenium script into jmeter script, I have created Webdriver script in jmeter, I need to run it with 100 users, as I donot want to launch 100 instances of browser, I want to run it as headless browser, directly creating jmeter load script is not an option as request is using a dynamic valuse which is not available in server response.
You will launch 100 instances of browser in any case, no matter whether browser is headless or not and most probably your JMeter system will not be able to handle that many browser instances and you will have to go for distributed testing
Your "no luck" statement doesn't make sense as information is not sufficient to come up with solution.
For HTMLUnit it is enough to add HtmlUnit Driver Config and WebDriver Sampler itself
For PhantomJS Driver Config you need to download PhantomJS binary and specify location under PhantomJS -> Path to PhantomJS executable input. Of course add WebDriver Sampler with your code
In both cases you will need to have Selenium client libraries somewhere in JMeter Classpath so make sure to install WebDriver Sampler using JMeter Plugins Manager - it will automatically take care of the dependencies.
If JMeter doesn't work as expected first of all check jmeter.log file for any suspicious entries - in 99% of cases it contains enough information to get to the bottom of the issue.
Also be aware that dynamic value is not a showstopper, in the absolute majority of cases it is somewhere in response (either in body, or in URL or in cookies, or in headers), in remaining cases it can be calculated or generated.

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.

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.

What is the difference between Selenium's Remote Control vs WebDriver?

I'm not sure I quite understand the difference. WebDriver API also directly controls the browser of choice. When should you use selenium remote control (selenium RC) instead ?
Right now, my current situation is I am testing a web application by writing a suite with Selenium WebDriver API and letting it run on my computer. The tests are taking longer and longer to complete, so I have been searching for ways to run the tests on a Linux server.
If I use Selenium Remote Control, does this mean I have to rewrite everything I wrote with WebDriver API?
I am getting confused with Selenium Grid, Hudson, Selenium RC. I found a Selenium Grid plugin for Hudson, but not sure if this includes Selenium RC.
Am I taking the correct route? I envision the following architecture:
Hudson running on few Ubuntu dedicated servers.
Hudson running with Xvnc & Selenium Grid plugin. (Do I need to install Firefox separately ?)
Selenium grid running selenium RC test suites.
I think this is far more time efficient than running test on my current working desktop computer with WebDriver API.
WebDriver is now Selenium 2. The Selenium and WebDriver code bases are being merged. WebDriver gets over a number of issues that Selenium has and Selenium gets over a number of issues that Webdriver has.
If you have written your tests in Selenium one you don't have to rewrite them to work with Selenium 2. We, the core developers, have written it so that you create a browser instance and inject that into Selenium and your Selenium 1 tests will work in Selenium 2. I have put an example below for you.
// You may use any WebDriver implementation. Firefox is used here as an example
WebDriver driver = new FirefoxDriver();
// A "base url", used by selenium to resolve relative URLs
String baseUrl = "http://www.google.com";
// Create the Selenium implementation
Selenium selenium = new WebDriverBackedSelenium(driver, baseUrl);
// Perform actions with selenium
selenium.open("http://www.google.com");
selenium.type("name=q", "cheese");
selenium.click("name=btnG");
Selenium 2 unfortunately has not been put into Selenium 2 but it shouldn't be too long until it has been added since we are hoping to reach beta in the next couple of months.
As far as I understand, Webdriver implementation started little later than Selenium RC. From my point of view, WebDriver is more flexible solution, which fixed some annoying problems of SeleniumRC.
WebDriver provides standard interface for testing web GUI. There are several implementations of this interface (HTTP, browser-specific and based on Selenium). Since you already have some WebDriver tests, you must be familiar with basic docs like this
The tests are getting longer and longer to complete, so I have been searching for ways to run the tests on a linux server.
Did you try to find actual bottlenecks? I'm not sure, that elimination of WebDriver layer will help. I think, most time is spent on Selenium commands sending and HTTP requests to system-under-test.
If I use sleneium remote control, does
this mean I have to rewrite everything
I wrote with WebDriver API ?
Generally, yes. If you did not implement some additional layer between tests code and WebDriver.
As for Selenium Grid:
You may start several Selenium RC instances on several different [virtual] nodes, then register them in Selenium Grid. Your tests connect to Selenium Grid, and it redirects all commands to SeleniumRC instances, coordinating them in accordance with required browsers.
For details of hudson plugin you may find more info here