Jmeter API testing using csv input as post request in localhost - jmeter

I tried to run a POST method for API testing in JMeter, I have sent the parameters as needed in body using a csv file. It works with https url(domain url) but not working in localhost. In localhost, requested body is showing blank. Please help me to resolve this issue.

There should be no any difference between local and non-local URLs so most probably you made a configuration mistake somewhere. We cannot state where exactly without seeing the test plan so I would suggest:
Inspect request and response details using View Results Tree listener
Ensure that the variables originating from the CSV Data Set Config really exist and have their respective values by adding a Debug Sampler and seeing what variables are there.
Check jmeter.log file for any suspicious entries. If it doesn't say anything meaningful you can try increasing logging verbosity to DEBUG level.

Related

How to send a HTTP request in JMeter which is having an environment in its url?

I want to send HTTP request to a particular URL in JMeter to do performance testing, but the URL is containing a environment name in its prefix ex: http://dev-www.abc.com/. while I'm running the particular script its failing because of the URL prefix.
How to achieve this?
If you are enter server name / IP as per screenshot below then it is wrong
Protocol and server name have to be given separately as below
If you already have setup URL like the screenshot above, please update the question with screenshot of failure message
Your question is not very clear, going forward consider adding:
output of the View Results Tree listener showing request and response tab, preferably both data and headers
jmeter.log file, preferably full, or at least any messages of WARN and above severity
A couple of "blind shot" answers:
If you're asking for a single configuration point which will be applied to all HTTP Request samplers - it's HTTP Request Defaults
If you're building your request URL dynamically and getting Illegal character found in host: '/' error - make sure to put the URL into "Path" field of the HTTP Request sampler:

JMeter HTTP Request shows a second failed result of a wrong URL

My results tree shows a separate status for a URL connection I have absolutely no idea where it might come from:
The first result with the -0 at the end is that of the request I send willingly. The other connection with the -1 comes out of the void.
In the response body I can see that JMeter fails while trying to resolve the DNS name:
java.net.UnknownHostException: aida.xyz.removed
at java.base/java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.base/java.net.InetAddress$PlatformNameService.lookupAllHostAddr(Unknown Source)
This is my definition of the HTTP Request:
As you can see this goes to a totally different host and protocol (http instead of https).
I checked the defined csv, it does not contain the hostname "aid". Same goes for the JMX file and any environment variables set.
I am using Apache JMeter 5.0
After I read Ubiks answer I checked if there are any redirects in the first request. There are no redirects but in the content there are several script and img resources.
It looks like JMeter parses the first request for resources it has to download. But I didn't enable this setting / don't even know where to activate this.
I guess it’s either a redirect issued from response to the first request or because JMeter tries to download embedded resources.
Check the response of first request.
If the reason is that JMeter downloads (probably missing) resources, make sure you disable Retrieve All Embedded Resources in the Advanced tab.
The error you're getting indicates the problem with the system under test, JMeter cannot resolve an embedded resource - image, script, style, font, iframe, whatever.
You need to raise an issue as not available content is not good i.e. for SEO purposes, moreover it might be essential for your application functionality of LAF
If this is a known issue which is in process of fixing (or considered as won't fix) you can turn JMeter's check for embedded resources presence by adding the next line to user.properties file:
httpsampler.ignore_failed_embedded_resources=true
JMeter restart will be required to pick the property up.
More information:
JMeter Properties Reference
Configuring JMeter
Apache JMeter Properties Customization Guide

JMeter - In My local UAT Server same URL request not hitting second time(Error - 500)?

JMeter - Parameterization(using CSV data),
JMeter - In My local UAT Server same URL request not hitting second time(Error- 500)
In My local UAT Server same URL request is not hitting second time it's displaying a Response code like - 500.
I generate script by using blazemeter chrome addons V.1.5.184.
Kindly give any solution for this.
It is not possible to suggest anything without seeing request details, response message, response body, your CSV Data Set Config details and partial CSV file.
Most likely your parameterization doesn't work as expected, I would recommend comparing what's is being sent in 1st and 2nd request using View Results Tree listener and double check variables coming from CSV using Debug Sampler. See How to Debug your Apache JMeter Script article for more details on JMeter tests troubleshooting.

Not getting proper response in the tree table after performing login scenario using JMeter

I just started to use JMeter with the tutorial (for a sample website), which returns clear response data.
But, when I started to use in one of my projects, I saw the response was encrypted in View results in tree.
So can anyone provide solution for it? This was the response i was getting
I doubt you haven't check marked 'Use this proxy server for all protocols' while creating manual proxy configuration. By checking/ ticking that check box it will allow you to record the scenarios and also it gives you a proper response.
and I also doubt that you are getting proper server name. By doing the above step it will solve your problem

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

Resources