Data correlation and concurrent users with Jmeter - jmeter

This is Naresh. Seems this blog is really helpful for the beginners and all.
I have chosen Jmeter for Perf. testing web-based application and it is build with the environment - Microsoft dot net(Asp.net 3.5 with C#). Would Jmeter helps me?
I have done some sample recordings, for e.g login and search.
Scenario1 - Login
Here I have recorded for login and then parameterized with CSV config file.
And executed later.
As I do not much hand on exp, do I need to add anything to the above config to run it perfectly. For e.g. adding HTTP cookie manager or ?????
How to run the concurrent users?
Scenario 2:
Here, I have logged in - login.aspx is recorded
given a search - search.aspx is recorded
results will be displayed right below the search in a tabular format - (same)search.aspx is recorded
I want to run this for 100 simultaneous search(s). I understood how to pass the CSV file.
I am sure there is some thing needed to be done for executing this scenario.
Do I have need to do Data correlation, if yes? how to do this?
Do I need to add HTTP cookie manager or HTTP cache manager......
Please help guys, would be grateful :)
Naresh

Yes you must add the HTTP Cookie manager and HTTP cache manager

Related

Run the recorded testplan in Jmeter and verify the the entry in the Database

Im using Jmeter and do performance testing for my web application. I record my actions in jmeter and play back the same. The testplan got run but when i verify the database manually, the new row is not created. The value got added in the existing line.Please help me out of this. I am struck in this step for 2 days
Verify if your requests includes hardcoded session's data. If your app manages sessions and you just "recorded" the actions, probably you are re-using the same session's data. Assuming there is a login page -> the requests after the login would use a session, usually returned for the login action.
As comments are not enough descriptive; posting a new answer. You can do this by using regular expression extractors, because -probably- the session info comes in the response (so extract it into a variable, by parsing the response with a regex extractor)
and then use the variable in further request/s.
This is a tricky way and need lot of work... even more if the session keep changing in subsequent responses (it usually change while moving worward through the page/app workflow), if that is the case you will need to extract the data after each request.
Please reffer to the jmeter manual for more info about regex extractors.

Jmeter: Issue with Response Data (HTML) and Is my script Functional?

I am using Jmeter(2.3.2) to create script for one of my application with a scenario which has flow for 4 to 5 pages. I have recorded the script using HTTP Proxy Server. The scripts has been generated successfully under Thread Group >> Recording Controller.
After running the scripts (Threads- 1, Ramp Up period - 1, Loop Count - 1 ), below are the observations I noted in View Results Tree:
The Result Tree view shows all as Checked(Green) - OK
The Sample result for all screens shows Error Count as 0 - OK
But in the response tab when I try to view the results by using 'Render Html' response data - the response data shows the same response for all the requests.
I am getting the response data of the first request for all the other requests.
I am not sure, whether the Jmeter script generated is functional or not? What is the cause for getting the same response data for all the requests?
Please, can anyone let me know what may the issue?
I bet that the same page you're observing is a kind of login page or dashboard which is accessible by unauthenticated user.
First of all make sure that you have HTTP Cookie Manager added to your test plan. It represents browser cookies and deals with user sessions and cookie-based authentication.
If it doesn't resolve your issue the problem is bigger and you will need to do some extra stuff. Modern web applications use multiple mechanisms of current state of things storing and managing, security enhancements and so on. From JMeter's point of view it results in dynamic mandatory parameters. The process of these dynamic parameters extraction from previous request and adding them to next request is called "correlation". So you need to do the following:
Detect which parameters being sent by a recorded script are dynamic. The easiest way is to record the same scenario several times and inspect request bodies to see what is being static and what changes.
Once you figure out which parameters are "interesting" you need to locate them in the first response body/headers/etc.
As soon as you have identified what necessary parameters are and where they live you need to use one of JMeter's PostProcessors to extract required values from previous response and save them to JMeter Variables
Once you have a JMeter Variable it can be used wherever required.
Depending on response data type the most commonly used JMeter's Post Processors which provide correlation capabilities are:
Regular Expression Extractor - the most commonly used test element which covers >90% of needs.
XPath Extractor - better to use against XML data i.e. for testing SOAP Web Services.
CSS/JQuery Extractor - when you need to fetch something from complex HTML where Regular Expression Extractor is useless.
So for putting everything together loog for "jmeter correlation" in your favorite search engine or see ASP.NET Login Testing with JMeter guide.
First JMeter 2.3.2 is WAY TOO OLD (10 years old), upgrade to JMETER 2.11.
Second, Jmeter cannot guess that the response if KO if the returned code is 200, so you need to add Response Assertion that will check for some text you expect in the page.

How to use jmeter using ant task - load testing on Dot Net application

I have just tried jmeter examples using ant task. I got the HTML output. Now,
I built my application using c#.net,asp.net,javascript,jQuery,Ajax,Json etc.
This is the url http://localhost/test/pagemanager.aspx which shows my
LOGIN Screen. Once after login, the user can access over multiple menus(pages) to access like checking their personal data, overall student details like batch wise, registering a new student etc... My URL http://localhost/test/pagemanager.aspxremains constant at every time.
The site can be accessed by multiple users for multiple times. I needs to find a load testing. Can some one give me a configuration step to find load testng to my application.
Thanks in advance.
First of all I would recommend recording your test scenario steps starting from login via JMeter build-in HTTP(S) Test Script Recorder.
See JMeter Proxy Step by Step guide for detailed instructions.
Once you have recorded test flow you'll need to do some correlation as the nature of ASP.NET applications assumes mandatory dynamic parameters like VIEWSTATE. So you'll need to extract VIEWSTATE and similar from previous server response and add it to next request.
See ASP.NET Login Testing with JMeter for more details.

JMeter - How do you group all requests related to a page to provide cleaner results?

Im new to JMeter and have just created a test plan using the proxy server.
The test plan covers a fairly long user journey on a web app with a lot of pages, images, scripts and css being requested, because of this when I run the test plan and view the results in a listener such as the 'View Results Tree' the sampler list is very long and if I try and use a graph there are so many results its hard to make out individual values.
Is there a way in JMeter where I could group all the requests related to a page under that page and only have to page name display in the listener but still have the ability to drill into an individual page and see the details for each sample?
Thanks.
For this you can use Transaction Controller:
https://jmeter.apache.org/usermanual/component_reference.html#Transaction_Controller
Keep Include duration of timer and pre-post processors in generated sample unchecked.
If you're looking to learn jmeter correctly, this book will help you.
I agree with PMD, Transaction controller is exactly what you need.
You can achieve that automatically (while you're saving your test) if you enable jMeter proxy's option Put each group in a new transaction controller.
A couple of more details (about jMeter Plugins' listeners I regularly use) here:
Define a group of requests in order to obtain a total time in Jmeter
You can use the tool BADBOY tool to record your test and there you can easily bifurcate/ remove the unwanted content.
From BADBOY you can directly Export the recorded script to JMeter by simply from
File menu>>Exort To JMeter
This is what currently we are following and is a bit easy to use.

jmeter regarding performance and load testing

Let me describe the issue which i have been facing.
i want to do performance and load testing on our internal website. which has login and other functionalities.
the issue i am facing that when i hit 12 or any number of request using http sampler then i am getting same response from all the 12 request. But actual scenario is that webpage displays different data for different page.
I checked using firebug and everything is working fine over there using correct response from request but when i use jmeter i am using same response from every request.
Please let me know if anybody had faced same kind of issue of is there anything i am doing wrong in configuring script.
Try to add HTTP Cookie Manager to your test-plan to the root (Test Plan) node or to the Thread Group node.
As per jmeter documentation:
The last element is a HTTP Cookie Manager. A Cookie Manager should be
added to all web tests - otherwise JMeter will ignore cookies. By
adding it at the Thread Group level, we ensure that all HTTP requests
will share the same cookies.
Ensure that parameters values that are dynamic are not hard-coded (after recording jmeter scripts, for example): no hard-coded JSessionID values in your HTTP requests, e.g..
Ensure you don't miss any necessary params in your HTTP requests.
JMeter does not process Javascript or applets embedded in HTML pages.
Your problem may be caused by this feature.
As per jmeter documentation:
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.
I would also recommend your to look first into Jmeter reference before further scripting activities - this may prevent from some faults and frustration.
At least these:
Building a Test Plan
Elements of a Test Plan
Building a Web Test Plan
Building an Advanced Web Test Plan
Hope this helps.
I would suggest - Use Jmeter's Regular Expressions. You may be able to resolve this issue with RegEx. Post using regex, use 'View Results Tree' listener to check if you are getting apt response for each of your threads.
You can also analyze your results using Blazemeter's listener that gives you more insights into your test.

Resources