Jmeter: Active Browser Tab - jmeter

Running Jmeter on a service whereby there is Duo MFA (with MFA being bypassed). The Duo MFA page bypasses only if in active browser tab. Would there be a way for Jmeter to mimic active browser?

Most probably your "Duo MFA" (whatever it is) is using JavaScript for detecting whether its being run in the browser and maybe even by human (i.e. it has bot-detecting heuristics)
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 I don't think that it is possible to "bypass" this real browser check without kicking off a real browser.
The options are in:
Ask your application developers/devops/whoever is responsible for the infrastructure to turn off this MFA as your test should focus on your application and not on external resources/dependencies
Use a real browser for bypassing it, for example WebDriver Sampler plugin provides JMeter integration with Selenium browser automation framework. Once you are let in you can transfer cookies from the browser into JMeter's HTTP Cookie Manager and continue using normal HTTP Request samplers
Try to reverse this "browser" check by inspecting the traffic which is going back and forth between your browser and this Duo MFA backend, if you'll manage to decrypt it - you should be able to replicate it so Duo MFA will think that you're using the browser, however I'm not sure that it's easily doable and legal

Related

Important - Jmeter -UI endpoint - response time deferring from developer tool response time

For performance testing testing Jmeter UI - endpoint - response time deferring from developer tool loading time
Ex Jmeter - endpoint response time is 615 Ms where in developer tool shows (Load: 13.30 s) Finish: 18.98 s
Note : Jmeter capturing 35 backend call/ Developer tool capturing 104 backend call
why jmeter couldn't capture all developer tool backend calls?
why jmeter couldn't capture all developer tool backend calls? do we have any solution for this issue
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 apart from configuring JMeter to behave like a real browser when it comes to handling embedded resources, cookies, think times and so on you need to pay attention to the nature of the requests which are being called when you open the page in the browser.
If the request is created by JavaScript, i.e. it's an AJAX call JMeter won't make the request automatically when you open the page. However you can record it using JMeter's HTTP(S) Test Script Recorder and run after the main request. The cumulative response time can be measured using Transaction Controller
Check the Retrieve All Embeded Resources in Advanced tab of the http sampler and see what is the difference.
Times will be always slightly different between dev tools and Jmeter or between JMeter and other performance tools like Gatling for example.

How to simulate the browser load in JMeter?

We need to test our web application with 100+ users with JMeter tool.
Should we use JMeter webdriver plugin to launch the real browsers or can we use the blazemeter plugin to generate the script and run in JMeter? Will the script created with blazemeter simulate the real browser load?
Theoretically you can use real browsers, but be aware that browsers are very resource intensive so my expectation is that you will need at least one CPU core and at 1 GB of RAM per browser instance in order to have enough resources.
This means you will have to go for distributed testing and on average you will have one slave per 5 browsers. If this is something you can afford - go for it. If don't - be aware that you can configure JMeter to behave like a real browser, to wit:
Tell JMeter to Retrieve All Embedded Resources from HTML Files and Use concurrent pool of 6 threads. This can be done using HTTP Request Defaults, the settings live under "Advanced" tab
Add HTTP Cache Manager to simulate browser cache
Add HTTP Cookie Manager to mimic browser cookies
Add HTTP Header Manager to send browser-like headers (i.e. User-Agent, Accept-Encoding, etc.)
If your application uses AJAX requests - put the relevant HTTP Request samplers under the Parallel Controller

Calling application javascript function

coSelectAll();
coUnSelectAll();
These function above are part of our application and when I run on chrome console it select and unselect a company structure. How can I call these functions from jmeter as I heard jmeter does not have access to DOM. I am a newbie so forgive me if this is a silly questions. What options are available in jmeter.
If these functions generate HTTP Requests you should be able to record and replay them using JMeter's HTTP(S) Test Script Recorder.
If these functions affect UI only (i.e. check some boxes or something like that) you won't be able to do test it using JMeter, 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.
Real browsers send HTTP Requests and render the response. JMeter can mimic sending any HTTP requests via HTTP Request samplers so from application under test perspective it won't be different from real user, but JavaScript is executed solely on client side so if it doesn't trigger any network activity - the server doesn't know anything about what is happening in the browser on client side.
If your test scenario assumes checking selection/deselection of company structure via invoking certain JavaScript functions consider switching to Selenium browser automation framework. Also be aware that there is a Selenium integration with JMeter via WebDriver Sampler.

Finding End user response time in Jmeter

How can we capture the end user response time in JMeter?
If there is any plug-ins available?
Can u please help me.
As per the main page of the Apache JMeter project
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)
Well-behaved JMeter test acts quite similarly to read users using real browsers given you properly handle embedded resources, cookies, headers, cache, AJAX calls, etc. See How To Make JMeter Behave More Like A Real Browser article for JMeter tuning recommendations.
I would also recommend using i.e. YSlow or WebDriver Sampler to measure real life user experience while the main load is being conducted using JMeter, this way you will be able to get more precise picture.

How to track & trend end to end performance (the client experience)

I am trying to figure out how best to track & trend end to end performance between releases. By end to end I mean, what is the experience form the client visiting this app via a browser. This includes download time, dom rendering, javascript rendering, etc.
Currently I am running load tests using Jmeter, which is great to prove application and database capacity. Unfortunately, Jmeter will never allow me to show a full picture of the user experience. Jmeter is not a browser therefore will never simulate javascript and dom rendering impact. IE: if time to first byte is 100ms, but it takes the browser 10 seconds to download assets and render the dom, we have problems.
I need a tool to help me with this. My initial idea is to leverage Selenium. It could run a set of tests (login, view this, create that) and somehow record timings for each. We would need to run the same scenario multiple times and likely through a set of browsers. This would be done before every release and would allow me to identify changes in the experience to the user.
For example, this is what I would like to generate:
action | v1.5 | v1.6 | v1.7
----------------------------------------
login | 2.3s | 3.1s | 1.2s
create user | 2.9s | 2.7s | 1.5s
The problem with selenium is that 1. I am not sure if it is designed for this and 2. it appears that DOM ready or javascript rendering is realllly hard to detect.
Is this the right path? Does anyone have any pointers? Are there tools out there that I could leverage for this?
I think you have good goals, but I would split them:
Measuring DOM rendering, javascript rendering etc. are not really part of "experience from the client visiting this app via a browser", because your clients are usually unaware that you are "rendering dom" or "running javasript" - and they don't care. But they are something I'd want to address after every committed change, not just release to release, because it could be hard to trace degradation back to particular change if such test is not running all the time. So I would put it in continuous integration on build level. See a good discussion here
Then you probably would want to know if server side performance is the same or worsened (or is better). For that JMeter is ideal. Such testing could be done on some schedule (e.g. nightly or on each release) and can be automated using for example JMeter plug-in for Jenkins. If server side performance got worse, you don't really need end-to-end testing, since you already know what will happen.
But if server is doing well, then "end user experience" test using a real browser has a real value, so Selenium actually fits well to do this, and since it can be integrated with any of the testing frameworks (junit, nunit, etc), it also fits into automated process, and can generate some report, including duration (JUnit for instance has a TestWatcher which allows you to add consistent duration measurement to every test).
After all this automation, I would also do a "real end user experience" test, while JMeter performance test is running at the same time against the same server: get a real person to experience the app while it's under load. Because people, unlike automation, are unpredictable, which is good for finding bugs.
Regarding "JMeter is not a browser". It is really not a browser, but it may act like a browser given proper configuration, so make sure you:
add HTTP Cookie Manager to your Test Plan to represent browser cookies and deal with cookie-based authentication
add HTTP Header Manager to send the appropriate headers
configure HTTP Request samplers via HTTP Request Defaults to
Retrieve all embedded resources
Use thread pool of around 5 concurrent threads to do it
Add HTTP Cache Manager to represent browser cache (i.e. embedded resources retrieved only once per virtual user per iteration)
if your application is build on AJAX - you need to mimic AJAX requests with JMeter as well
Regarding "rendering", for example you detect that your application renders slowly on a certain browser and there is nothing you can do by tuning the application. What's next? You will be developing a patch or raising an issue to browser developers? I would recommend focus on areas you can control, and rendering DOM by a browser is not something you can.
If you still need these client-side metrics for any reason you can consider using WebDriver Sampler along with main JMeter load test so real browser metrics can also be added to the final report. You can even use Navigation API to collect the exact timings and add them to the load test report
See Using Selenium with JMeter's WebDriver Sampler to get started.
There are multiple options for tracking your application performance between builds (and JMeter tests executions), i.e.
JChav - JMeter Chart History And Visualisation - a standalone tool
Jenkins Performance Plugin - a Continuous Integration solution

Resources