Jmeter - Simulate link(href) request (javascript) - jmeter

I am new to Jmeter. So far I have been successful in getting Jmeter to
access my companies test site. Login and retrive results by sending
parameters. However now I have a problem.
How can I get JMETER to simulate the href click this randomly generated links? Also the link
is a popup link. An example of the link is posted below.
<a class="qmchild" href="javascript:goMenuLink(5,6);" name="SUBSearch by Batch" id="SUBSearch by Batch" style="font-weight: normal;">Search by Batch</a>
I can extract "javascript:goMenuLink(5,6)" using CSS/XPATH/REGEX but the problem is how to send that HTTP Request from JMeter as I don't the target of the href?

If it is pure javascript - there is no point in using JMeter as it does not execute Javascript. Also, It does not make sense for JMeter to execute Javascript either as it is the tool for testing the Server performance. Javascript is going to run in your Browser-local machine.
However, if it is a HTTP request, ie - when you click on this link, if it hits a server to load the pop up - you should be able to record as you did with your login request. Try to see what is sent in the http request when you click on these links - Then I am sure you would be able to figure it out!

Related

handling dynamic pop-up error message in jmeter

I have a Jmeter script for an application for which i get pop up error message intermittently. Where as in jmeter we only come to know that flow got terminated by some failure.But we wont come to know the occurrence of Error pop -up message.
My requirement is if we encounter pop up error i want to write to an external file saying that ,the current page got failed due to pop-up error message.
If we can write the error message it's really great. I'm as of now not getting idea to achieve this.
Please can anyone help me in this. or can provide any hint to do R&D.
Thankyou in advance.
Updated the question with screen shot of error message.
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).
Looking into your screenshot, it is a form of JavaScript popup, most likely window.alert so there is no way to detect it via JMeter.
You can add i.e. Response Assertion to your test in order to introduce some pass/fail criteria, i.e. if you were in the middle of some transaction when the error occurred it should not finish successfully resulting in missing expected entry in the web page (or database), so you can conditionally fail relevant sampler(s) in this case. See How to Use JMeter Assertions in Three Easy Steps to learn more about the concept.
Alternatively you can use WebDriver Sampler plugin which provides JMeter integration with Selenium browser automation framework which drives a real browser, so you will be able to capture this popups and record the page titles/take screenshots, check out IsAlertPresent() class for more information.
you must get this error response in your jmeter request response.simple answer.Have a regex to extract.

Test download a file using Jmeter (the http response has download link)

Test 'download a file using Jmeter': On the web page, there is a button 'download' and clicking it downloads the file with .zip extension. When observed under Network tab of Developer tool (F12)>there are two requests: 1 is the application request which gives the response with link (aws-S3...) (if i copy paste this link, can download the zip file) and 2nd request shows the aws-S3..link. When need to perform this download performance testing with 100 users, how to configure in Jmeter. Please guide. below thing have been tried:
Record a script>it records the first request (not the 2nd request of network tab as mentioned above)
When run the script> this shows 200 code with response message as aws-S3..link
Tried Save response to file listener> nothing has been downloaded.
Extract the download link from 1st response using i.e. Regular Expression Extractor
Add put the JMeter Variable generated by the Regular Expression Extractor into "Path" input of the HTTP Request 2
Add Save Responses to a file listener as a child of the HTTP Request 2
See Performance Testing: Upload and Download Scenarios with Apache JMeter article for more information on simulating file upload/download events in JMeter web tests.

Data entry through Jmeter not reflected in UI of application

I'm using Jmeter to perform load test on Moodle application
I followed the below steps to replicate a simple "add company " test scenario
1: Recorded the browser actions through HTTP Test script recorder and created a test plan with thread user of 1
2: Added HTTP Cache Manager,Added regular expression extractor for retrieving dynamically generated session for login HTTP request.
For Http request of adding new company, addded user parameters containing new company name
I run the test, everything seems ok in the view results tree- response section (response code: 200,response message:OK), all the required variables are passed in the HTTP POST
PROBLEM: New company added through Jmeter test is not reflected in UI of the moodle action
Can any of you please let me know
Is there something I could be missing or anyway I can debug the problem?
P.S: I'm new to Jmeter and looked around a lot for data inputted through Jmeter not being displayed in the UI of the web application,dint find useful results.
The answer to questions of this sort is almost always that you missed some necessary dynamic value besides session ID which you did catch.
An HTTP200 response just means the server returned a "good" response. Which could also happily contain an error message.
I would check the actual html body of the returned response for any errors. Checking the log on the server side can give you clues to what went wrong sometimes. You should also try adding a cookie manager.
Run your test with 1 virtual user in GUI mode with View Results Tree listener enabled and inspect responses to see where your scripts fails. My expectation is that you simply cannot log in.
See Moodle-JMeter-LoadTest.jmx file for reference, it uses XPath Extractor to get session key and course id.
I don't think you can test using JMeter. Try JUnit Test cases instead http://jakarta.apache.org/jmeter/usermanual/junitsampler_tutorial.pdf

Tips to confirm JMeter script is working when receiving no errors

I am running a JMeter script to hit a web page that opens another link to a shopping cart. There are a few different urls that JMeter recorded for me using the HTTP Script Recorder. When running the JMeter script, I receive no errors in any logs ( JMeter log and a few summary report / View results tree logs ). I even added a Constant Timer to some of the pages that do actually take a few seconds to load when hitting them manually in a web browser. In the end, I cannot see what is happening, but JMeter also does not indicate any errors. How can I confirm that each url hit is actually succeeding so that the shopping cart actually gives me my item when JMeter is done?
If JMeter is able to make a http request successfully, it will be always green in View Results Tree (200 http code). It does not mean that your test is correct - ie even if the login is not successful JMeter does not report it as error/failure unless you validate the response.
I think you need assertions to ensure that the http response you get is as you are expecting.

Jmeter - Performance test

I want to load test my web site.
I can extract all http requests from the site and put it on J meter.
But the page have alot more things(like ajax calls)
How can i load test my site (find complete page load time)
I'd go the route of capturing the AJAX calls as past of your script - you have two options:
The JMeter proxy:
http://jmeter.apache.org/usermanual/jmeter_proxy_step_by_step.pdf
BlazeMeter's JMeter chrome extension:
https://chrome.google.com/webstore/detail/blazemeter-the-load-testi/mbopgmdnpcbohhpnfglgohlbhfongabi/details?hl=en
Jmeter is Server side load testing tool and though client is using ajax still http request will be sent to server which will be recorded/scripted in jmeter and thus load testing can be carried out.
please check similar questions on jmeter
check this also
http://jmetertips.blogspot.in/2009/04/ajax-testing-with-jmeter.html

Resources