How to check the acessibility of a page using JMeter - jmeter

Have to check the accessibility of one API. If it has not opened within any stipulated time and then send email to stakeholders. When I am using "Duration Assertion" to check the time duration, than JMeter will access the page first calculate the time than compare with the given time and do the action.
But the problem is to check the accessibility. So when it is not accessible or down than the meter is waiting for it irrespective of the time limit.
So how to kill the process and send the email if the API is not accessible or down.

You must set :
Connect timeout
Response timeout
As per this screenshot :

Related

Dynamic data not recorded by LOADRUNNER or JMeter

In one of my project we are searching for a vehicle number, it has to show the vehicle number exists or not.but i in the devtool i an not able to find the searched vehicle number.
Let's say I have searched for 5555 , 5555 should record as a parameter in JMeter load runner, even developper tools also it's not showing.
How can I handle this in JMeter.
Let's assume you start a transaction just before you submit your form with '5555' in it within the recording of loadrunner (either default sockets recorder or fiddler-based proxy recorder). You submit your form. You stop your transaction. You then complete your recording.
What do those requests between the start and end transaction markers look like?
If browser developer tools don't show the request it means that there is no request, most probably it happens on the client side only hence there is nothing to test with JMeter/Loadrunner there.
Or it might be hidden/filtered/using another protocol.For example this page won't show sent and received requests at the default view because they're happening in a single WebSocket connection and you need to switch to WS tab and then open Messages view:
The above website cannot be recorded with JMeter/Loadrunner, in JMeter you will need to use WebSocket Samplers and in Loadrunner web_webcoket_* functions
You can also consider using a more powerful packet capturing solution like Wireshark which can catch literally everything and look for your payload in the raw network packets. It will allow you to identify the network protocol.
And last but not the list: try recording your scenario in "porno mode" as it might be the case your application has cached the response and it's being returned from i.e. local storage so no actual network request is being made

How to receive multiple websocket responses send in sequence, for a single request sent, using JMeter

I'm trying to setup a performance test for a websocket application, using JMeter.
The request is {"type":"subscribe_rq","id":1,"ts":"2018-10-16T00:00:00","data":{"sinceSeq":0}}.
Response is multipart and sequential; initial response and an update every second, as long as the connection is open. (I checked this with "WebSocket Test Client", a chrome extension).
Currently, I only get the first main response, but not the updates. Rather not sure how to get these updates. How to achieve this in JMeter? That is, how to keep the connection open for a specified period (say 5 secs) and receive the multiple responses during that period and assert it?
To keep the connection open I have a Constant Timer with 5 secs in Thread Delay. Not sure if this will work...
Going forward please remember to include essential parts of your query into the question itself, i.e. output from the "Network" tab of the browser developer tools or screenshot of this WebSocket Test Client (whatever it is) could tell the full story.
In the mean time, there is a project: JMeter WebSocket Samplers by Peter Doornbosch which has many useful sample JMeter Test Plans including the one which you can use as the basis: Single read sample.jmx which queries the data in the loop over the single WebSocket Connection.
Check out JMeter WebSocket Samplers - A Practical Guide article to get started with the WebSocket Samplers.

website benchmaking tool with automatic mail support

I'm looking out for a tool that supports recording option in web on the tasks that I perform (search and result analysis).
I finally rerun the recorded script and calculate the time that is taken for each page that is loaded (generally based on the search criteria) within the web.
Once the page loading exceeds the defined time, the exceeded time should be highlighted.
The reports on this should be automatically saved.
The above scenario was tried using jmeter, but I was not able to set benchmark and automatically set the scenario as failed when the page load exceeds the defined number.
Please suggest a tool that could be used for the above mentioned scenario, and if the same could be done using Jmeter that I'm missing out.
Thanks in advance..!
In JMeter you have :
Duration Assertion which you can utilize to set the response time threshold. If response time exceeds the time set in the duration assertion JMeter will automatically mark the relevant sampler(s) as failed
SMTP Sampler which can be used for sending JMeter test results to the specified recipient(s). Add a tearDown Thread Group to your Test Plan (tearDown Thread Group is being executed after all other Thread Groups), put SMTP Sampler under this tearDown Thread Group and configure it to send .jtl results file at the end of the test. See Load Testing Your Email Server: How to Send and Receive E-mails with JMeter article for example configuration.

How i can Keep user login session alive for fixed time in jmeter

I already tried to login with 50 concurrent users and visit a page, its working fine.
But its automatically logout after sometime.
How i can Keep user login session alive and sending request in defined time frequency in jmeter.
Possible duplicate : Maintaining http request in jmeter for certain amount of time
For maintaining session: it depends on how it is implemented on application under test side. The most commonly used configuration is:
Add HTTP Cookie Manager
Make sure that Clear Cookies each Iteration box is not ticked
For sending request in defined time frequency, use one of the following:
Constant Throughput Timer
Throughput Shaping Timer - this one more precise on < minute time spans, more flexible and easier to use but you'll have to install a plugin

How to handle session timeout when a device was suspended in an Ajax app?

It's easy enough to build an Ajax app which checks all responses to make sure they aren't indicative of a session expiry, and if the session has expired automatically log the user out with a friendly "Your session timed out due to inactivity" error message.
But a common occurrence in Ajax applications is that:
User is logged in, happily using app, retrieving data over http with an established http session
User closes laptop
Host times out http session after N minutes
User reopens laptop later on. Ajax app appears alive and well. They click around which is just fine since the app lets them see things they've already loaded.
Then, they click on something that requires data to be loaded, and the data comes back indicating session expiration
The Ajax app kicks them out and says "Your session timed out due to inactivity".
This is really weird to the user because they were not inactive from their point of view.
Now, one possibility is to have Javascript code in the client which uses setTimeout() to periodically (say, every 15 minutes if the session timeout is 30 minutes) trigger a request to the host to ask how much time is left in the session. This periodic check is great because it lets you show them a warning when they are close to timing out, e.g. "You're session will time out in 1 minute unless you do something".
But that doesn't help when the user's machine is suspended. That's because according to all my testing in many different browsers, setTimeout time applies to elapsed running time instead of elapsed real time. That is, if you call setTimeout("alert('hi')",2*60*1000); and then suspend your machine 10 seconds later, wait 5 minutes, and reactivate your machine, you'll have wait 110 more seconds until you get that alert (I have not been able to find definitive documentation of this behavior but it is a demonstrable fact). So that means your period check may not happen for quite after the user's machine resumes.
My solution to this is to, instead of having my periodic check based on on a long setTimeout, instead do a short setTimeout (say, every 5 seconds), and check the elapsed time since the last check using new Date().getTime() to get the actual clock time. This way I am always checking against the real clock, and instead of the client waiting from zero to fifteen minutes before realizing it has timed out after a suspension, at most it will wait about five seconds (plus http response time) to find out.
But I dislike this solution because it relies on a frequent timer based interruption. Is there a smarter way to handle this?
With big sites like facebook, which is rich with interactive updates, you'll find that there is a combination of all sorts different mechanisms. I'd guess that they're doing validation both on API requests and on Push requests (since someone once told me they use push in addition to ajax)
Timeouts: One thing to consider is that if you store session data in a cookie, having that cookie expire is the same as no longer being logged in. Since the cookie is a hashed value of a few things like a user ID, or a timestamp, it is really easy to see that a session is no longer valid on the very first function call to the API.
Long polling: if a site uses long polling in which a connection is opened indefinitely to await a response from the web server, then closing your computer would kill that connection.
However, if they're just doing regular ajax polling with a reoccurring function call via setInterval, then the web server would automatically know whether the user should get data in return based on the timestamp in their hashed cookie, assuming there is one to check. Those are the types of things that get sent in the header.
Some services actually update a database field that stores your timestamp of last activity and then expires if a certain amount of time has elapsed. This is a less efficient way to do it since it keep track of state.
There's really quite a few ways sites do these things.

Resources