How to POST data in in REST API using J meter - jmeter

by HTTP request
enter image description herebase url is: http://124.124.21.165:8093/FieldApp/Service.svc/

Your configuration looks good, I would suggest just adding a HTTP Header Manager to send Content-Type header with the value of application/json
Also it would be good to add View Results Tree listener to inspect request and response details (don't forget to remove or disable it when it comes to running the load test assuming large amount of users)
Check out Testing SOAP/REST Web Services Using JMeter test plan for step-by-step instructions

Related

performance testing using jmeter cross checking the response with web data does not match

I have a web service URL:
https://app.snapmed.no/landing-page?flow=chat
The response code is 200 and the response body does not contain any valid data to cross-check with the webpage response or data in chrome It is completely dynamic. Now I do not know a enter image description hereway to add response assertion for this type of response. can someone help me?
Actually you don't have to use assertions, as per Reducing resource requirements chapter of JMeter Best Practices
Use as few Assertions as possible
JMeter automatically checks HTTP Response status codes and marks the HTTP Request sampler as failed if response code is 400 or higher.
If you want to add an extra layer of check you can explicitly validate that the page returns the HTTP Status Code 200 as follows:
also as far as I can see the web page always contains Send bilder til hudlege text so you can validate it as well:
More information: How to Use JMeter Assertions in Three Easy Steps

Possible if want to do API Load Testing using JMeter with URI info only?

My team planned to do API Performance Testing using JMeter 5.0 for my client. My client developed the API in Kubernetes. Just wondering, they gave info such as URI, HTTP Method and Content-Type only. We never have experience using URI. Are these info sufficient to do load test in JMeter? And where do I fill in these info? Is it in Config Element: HTTP Header Manager?
Because usually I only do my enablement using sample website which already provide the URL.
Do I need to ask them to provide the specific URL for this? Or URL can be extracted from URI?
Thanks.
Normally you should put:
Protocol, server name or IP and Port Number into HTTP Request Defaults, this way you will have a single configuration element having these details and in case of change you will need to introduce the change at one place only and won't have to revisit each and every HTTP Request sampler
Individual requests are defined using individual HTTP Request samplers where you need to provide URL Path and request body (if any)
Content-Type and other Headers can be provided via HTTP Header Manager, the same Scoping Rules as for HTTP Request Defaults apply, for example if you want to send application/json for all the requests just add HTTP Header Manager on the top of your Test Plan and it will add the header to all HTTP Request samplers which are at the same level as the HTTP Header Manager or lower.

Load Testing in Struts2 Application - JMeter

I am trying to do a load test using JMeter for the first Time.
My approach is to test each page one by one.
The main page is like http://localhost:8180/myapp/login.do?actionType=login(I hardcoded the credentials)
I am able to reach this page without any problem.
I created a HTTP request component and able to see the response without any issue.
In the main page there is a button which populates the report, in the browser , the url is like
http://localhost:8180/myapp/mainmenu.do
But when i create a HTTP request it is reaching but shows the security error page in the 'Response
Data' as Due to security reasons, we still recommend you to close this window.
can someone guide me how to test the other pages without these security errors. This is a struts2 Web application.
No matter what technology is being used under the hood of the web application you're testing you should stick to one simple rule:
Well-behaved JMeter test must send exactly the same requests as real browser
It includes:
Same number/sequence/nature of the HTTP Requests
Same HTTP Headers (including Cookies)
any dynamic values need to be properly correlated
Once JMeter will send the same requests as real browser does it should receive the same responses. So just use a 3rd-party sniffer tool like Fiddler or Wireshark to capture the requests originating from browser and JMeter and amend JMeter's configuration until the requests start looking exactly the same. This should resolve your issue.
Solved the issue by adding HTTP Cookie Manger and
set Cookie Policy as Standard
click HTTP Cookie Manager
and click save icon on the top.
Source
https://jmeter.apache.org/usermanual/build-web-test-plan.html#adding_cookie_support
Thanks #Dimitri T and #Roman C for their valuable suggestion.

"Post" method test result error in JMeter API testing

I tried to run a POST method for API testing in JMeter, I have sent the parameters as needed, but still it shows cannot post.
What should I do to make it work?
user add post request
response message
If you are testing an API my expectation is that you need to send either JSON or XML payload using "Body Data" tab of the HTTP Request sampler.
You will also need HTTP Header Manager to send the relevant Content-Type header
References:
Building a SOAP WebService Test Plan
REST API Testing - How to Do it Right
Another way of building a web service test plan is executing the request(s) according to your test scenario using a 3rd-party tool like Postman or SoapUI and recording them via JMeter's HTTP(S) Test Script Recorder.
In the post request, you need to provide server name or IP address and port number respectively. If it still doesn't work, try changing the path by adding /api then /user/data. it works in some cases.
Hope this works out!

services working fine on rest client but not on Jmeter

I am performing load testing of my web based application.
The service page is working fine on Advance Rest Client application but it is giving 404 page not found error on Jmeter.
Please guide me how to resolve.
404 means your url is probably wrong.
Show your configuration of Test plan for further details.
Add View Results Tree listener to inspect request and response details, HTTP 404 response code usually stands for non-existent URL.
Most likely you'll also have to add HTTP Header Manager to send the relevant Content-Type header as your request might not be properly handled due to missing or incorrect content type.
I would recommend using a sniffer tool like Wireshark to compare what's being send by the "Advance Rest Client" and by JMeter and tweak JMeter test accordingly. If you fail to figure that out by yourself - you can upload captured traffic files somewhere so we could take a look.
See Testing SOAP/REST Web Services Using JMeter guide for baseline JMeter configuration for testing web services.

Resources