Using JMeter to test an OpenXava application - jmeter

I'm facing a problem when writing a JMeter test plan.
The goal is to test an OpenXava based application.
I perform the request with firefox then I try to copy the headers, parameters and cookies in my HTTP request sampler (thus in JMeter).
There are a lot of parameters (36) sent when trying to login. I copied all of them.
However, I can't make it work.
The HTTP response seems useless. It's nearly the same I get when sending a wwrong password with Firefox :
throw 'allowScriptTagRemoting is false.';
//#DWR-INSERT
//#DWR-REPLY
var s0={};
dwr.engine._remoteHandleCallback('1','0',{application:"bdsa",changedParts:null,currentRow:-1,dialogLevel:0,dialogTitle:null,error:null,focusPropertyId:null,forwardInNewWindow:false,forwardURL:null,forwardURLs:null,hideDialog:false,module:"SignIn",nextModule:null,propertiesUsedInCalculations:null,reload:true,resizeDialog:false,selectedRows:null,showDialog:false,strokeActions:s0,urlParam:null,viewMember:"",viewSimple:false});
Do you have a clue about what is happening ? Should I try to test the login page with another method ?

Why don't you just record your flow using JMeter's HTTP(S) Test Script Recorder and your browser.
Set up JMeter Proxy Server
Set up your browser to use JMeter as the proxy
Perform the test scenario in the browser - JMeter should capture the requests under the Recording Controller
Perform correlation if required. If your application is deployed in the Internet you might get benefit of cloud-based proxy service which can perform automated detection of dynamic parameters and generating the relevant code to extract the values and substitute recorded hard-coded parameters with the variables
Don't forget to add HTTP Cookie Manager to your Test Plan - it deals with cookies and cookie-based authentication

Related

Response message: Unauthorized in Jmeter

I'm new to using Jmeter tool.
I have recorded my application using blazemeter (v3.1) and then trying to run that .jmx file in Jmeter, however I am running into an authorization issue and the script fails to run.
I have also tried setting my "HTTP Authorization Manager" with username, url, password but it does not help. If anyone can, please guide me on this Issue. Thanks.
As per 4 Things You Should Never Do with Your JMeter Script article:
Don’t run the script exactly as you recorded it
After recording your script, there is still some work to do before you run it. It’s necessary to correlate variables, parameterize and add elements, to faithfully simulate users.
There are too many ways of possible authentication implementation in your application, most probably you need to send some dynamic value along with credentials which can be fetched from the previous request.
Record your test scenario 2 times and compare recorded requests. Be careful as differences might be in response headers and URL, not only in response data. It makes sense to add View Results Tree listener directly to HTTP(S) Test Script Recorder - this way you will be able to see what data is captured by JMeter and amend its configuration so simulated request would look exactly like the request from the real browser.

How to conduct performance testing where The service uses meteor js

How to conduct performance testing of my web service? The service displays a page, then the login form in the user's Personal account. It is necessary to enter and display the user's personal account. The service uses meteorjs. To display the personal account is necessary to emulate a browser. jmeter as I understand it is not suitable for this test. He(jmeter) is not able to emulate the browser can't request the js script on the client. Can you recommend tools for such testing? And how conduct ?
Thks
Well-behaved JMeter test can do whatever browser does (from protocol-level perspective). JMeter will not execute client-side JavaScript, neither it will render the response, however if JavaScript generates a HTTP request - JMeter can even record it using HTTP(S) Test Script Recorder (or you can manually create this request by adding relevant HTTP Request sampler)
So the options are:
If your request is ad-hoc (i.e. periodic or on-demand) you can use HTTP Request sampler to mimic it
If your request is asynchronous (AJAX) you can go for one of the techniques described in the How to Load Test AJAX/XHR Enabled Sites With JMeter article or use Parallel Controller plugin
And finally you can use JMeter for kicking off real browser instances using either WebDriver Sampler or JSR223 Sampler

Much difference in time by single user without tool and single user with jmeter

I am trying to login to an application first with single user and recorded the time using "Page load time" plugin of chrome and then i am trying to login with Jmeter and applying load of Just 1 user but there is much difference in time.
is my approach correct? if yes why there is difference in load time.
Well-behaved JMeter request should give the same timings as browser does.
Make sure you configure your HTTP Request sampler to "Retrieve All Embedded Resources"
Ensure that you have Parallel downloads ticked
Add HTTP Header Manager and configure it to send all the HTTP Headers which browser is sending.
If web application you're trying to load test is built using AJAX technology you will need to add the relevant HTTP Request samplers to mimic asynchronous JavaScript-driven calls as JMeter doesn't execute client-side JavaScript. Once done you can combine requests into one "Login" sequence using Transaction Controller.
See How to make JMeter behave more like a real browser article for more hints on how to properly configure JMeter for web applications testing.

How to execute Ajax requests in JMeter?

I want to execute Ajax requests in JMeter. I record my test plan with JMeter and BlazeMeter but none can handle Ajax requests. How can I solve my problem?
Or is there any tool that can send concurrent Ajax requests?
Thanks in advance,
M.A
By default, Ajax requests can't be simulated by JMeter as it does not process .js files (As of 3.1 version). You have to explicitly add the requests (HTTP Samplers) for AJAX requests.
Use Network tab of a browser (F12 option) and filter the traffic by xhr, which shows only AJAX requests. Add those requests as HTTP Samplers in the script at the point you needed in the Test Plan.
Browser can process .js files, hence AJAX requests are sent from the browser. When you record the script using HTTP Test Script Recorder, as you are using the browser to navigate, even AJAX requests (originated from js files) will also be added/recorded to the Test Plan.
Since JMeter can't process .js files due to limitation, manually add the AJAX requests (nothing but HTTP Get or Post requests) using HTTP Sampler, if you are building the Test Plan without HTTP Test Script Recorder.
Note: If you are using HTTP Test Script Recorder, no need to add them manually as they are already recorded in the Test Plan.
you can do that by recording http traffic with JMeter Proxy
http://jmeter.apache.org/usermanual/jmeter_proxy_step_by_step.pdf
but it is only possible to replay the same traffic, can be problematic for sessions, cookies...
Better solution is to use WebDriver
https://jmeter-plugins.org/wiki/WebDriverTutorial/
https://jmeter-plugins.org/wiki/PluginInstall/
the needed package is https://jmeter-plugins.org/files/packages/jpgc-webdriver-1.4.0.zip
It is not possible as kicking off more threads than originally defined in the Thread Group is not currently supported, the feature is being tracked as Bug 53159. AJAX requests are "normal" HTTP Requests so JMeter can record and replay them, but when it comes to asynchronous execution - you cannot do this as of now. The workaround options are in:
Use WebDriver Sampler plugin so each JMeter virtual user will kick off a real browser. Warning: this way is very resource intensive.
Use scripting, i.e. JSR223 PostProcessor to kick off AJAX-driven requests via Apache HttpComponents
Develop your custom sampler. You can use the current way of handling embedded resources as a reference.
Learn more: How to Load Test AJAX/XHR Enabled Sites With JMeter
I had this same problem after recording samplers using the JMeter Proxy. The answer was on this blog post: https://lincolnloop.com/blog/load-testing-jmeter-part-1-getting-started/ - see the Ajax Requests section.
Add an HTTP Header Manager for the ajax request and make sure you are sending the X-Requested-With:XMLHttpRequest header.

Capture WebDriver requests in Jmeter

One of the services I gonna test using Jmeter has complex authorization mechanism that requires some CS-based steps (JavaScript). So, to set up a session, I have to use WebDriver as Jmeter can't (and actually shouldn't) process JS.
I do it in the following way: at the beginning of each thread I open the resource in real browser (via Jmeter WebDriver plugin), complete authorization, store browser cookies that was set up by server and then use these cookies to generate load using standard Jmeter logic within defined HTTP-session.
This schema works fine and I successfully use it in different load tests.
But now the service I test requires not only cookies but also some important parameters that browser sends in POST as a part of authorization process. To prove that my requests belong to the same session, I should extract some sensitive parameters not from response (it can be easily done) but from request.
I can't find these values stored anywhere in DOM and it seems like these values are generated by JS attached to response page.
So, my question is: is there a way to capture parameters from request sent by WebDriver?
I understand that all requests done by browser initiated in Jmeter are not visible to it. And the only idea I see is to use Jmeter request recorder dynamically:
Open browser window.
Define Jmeter as a proxy for this browser.
Capture requests sent by browser in Jmeter using recorder.
Somehow extract sensitive data from requests.
Use the data to generate load.
Any ideas appreciated. Thanks in advance!
Solved the issue by running local proxy server (BrowserMob Proxy project) using BeanShell sampler. I retarget the WebDriver Sampler to this proxy, perform required actions using browser, then store captured data in HAR format and process it (extract required data from requests). Then just store valuable request parameters in variables (or properties) and use them in a regular way in HTTP sampler to generate load. Hope it can help anyone else in future.

Resources