JMeter gives me bad request once I run the thread - jmeter

it seems to be jmeter doesn't see the parameter required even I wrote them. I tried a lot of versions and still the samee. It works fine using postman (curl)

Most probably it's not JMeter who "gives" you bad request, it's the system under test tells you that request is malformed via HTTP Status Code 400
There is only one version which will "work" but we cannot tell you which one unless you're willing to share the "working" request details from curl and/or postman.
If you can run the request successfully using curl or Postman you can:
Create a test plan from Curl command
Record curl command execution via JMeter's HTTP(S) Test Script Recorder by running your curl request via JMeter's proxy:
curl -k -x http://localhost:8888 your-request-parameters http://your-server-endpoint
Record Postman request execution via JMeter's HTTP(S) Test Script Recorder

Related

How to run locust from command line without disabling locust web UI

How to run locust from command line without disabling locust web UI?
As per the locust documentation
To start tests directly, without using the web interface, use --headless.
ref : https://docs.locust.io/en/stable/quickstart.html?#more-options
But this would disable the web UI. How to start tests directly but also keep the web UI ?
Start locust by using cmd locust or locust -f <locustfilename.py>
To trigger the test using cmd and also keep the locust web UI I found the below workaround .
Trigger the test using the /swarm url
curl -X POST http://localhost:8089/swarm -H 'content-type: application/x-www-form-urlencoded; charset=UTF-8' -d 'user_count='10'&spawn_rate='1'&host='http://localhost:8080'
To end, use /stop url
curl http://localhost:8089/stop
It will be easy to build a script with the above curls to trigger /swarm the test, then sleep for a period of time (run duration) and then stop the test using /stop.
This way the locust web UI will also be available unlike the --headless mode.

Test script is failing when executed via Newman in Jenkins while works fine in postman and no postman console error comes

Getting below error when execute tests via Newman - Jenkins. The same request works fine via postman.
HTTP request parsing failed with error: "Malformed URI: /v1/addresses?country=AUS&id=AUG|5f246f9b-7c97-4233-8de7-2d57f74cd86b|7.7305OAUGGwvjBwAAAAAIAgEAAAAAB7zTAAAAAAAAADEAAP..ZAAAAAD.....AAAAAAAAAAAAAAAAAAAAMTc3IHBhY2lmaWMgaHd5AAAAAAA-$15"
Newman Report:
Jenkins console output:
Postman Screenshot
The same test passes in Postman while when executed via newman this fails.
Please note it was working fine till 2 days back but after new deployment this doesn't work anymore.
Add below code in pre-request script and it worked in Newman as well.
pm.request.url.query.each((q) => {
q.update(encodeURI(q.toString()))
});

I am getting Assertion Failed error while running jmeter script But I have not used assertions in my script

I am getting Assertion Failed error while running jmeter script But I have not used assertions in my script.
I was doing Load testing with 500 users and getting Assertion Failure errors
Most probably your script fails to download at least one so called "embedded resources" - image, script, style, font, etc. If you are not interested in the problems with the embedded resources - you can turn JMeter automatic check for HTTP Status code < 400 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.
If you don't want the change to be permanent you can pass it on ad-hoc basis using -J command-line argument like:
jmeter -Jhttpsampler.ignore_failed_embedded_resources=true -n -t test.jmx -l result.jtl
More information:
Configuring JMeter
Apache JMeter Properties Customization Guide
JMeter Properties Reference: Miscellaneous configuration

Jmeter Proxy giving 504 gateway timeout error

I have URL which is like this:
https://110.111.72.72:8001?id=username1
when I use the same URL in browser it works fine and return a result but when I use the same in Jmeter I get a 504 Gateway Timeout error.
In my organisation we do have the proxy which I have mentioned in the browser LAN -> proxy server settings.
I have tried many things but none worked please help.
You need to configure JMeter to use the same proxy server your browser is using. It can be done in 2 ways:
Via command-line arguments. In this case you will need to run JMeter as:
jmeter -H your_company_proxy_host -P your_company_proxy_port-u username -a password
Via Java System Network Properties. In this case you will need to add the following lines to system.properties file (located in "bin" folder of your JMeter installation)
http.proxyHost=your_company_proxy_host
http.proxyPort=your_company_proxy_port
https.proxyHost=your_company_proxy_host
https.proxyPort=your_company_proxy_port
More information:
Using JMeter behind a proxy
Apache JMeter Properties Customization Guide
Thanks Dmitri T
jmeter -H your_company_proxy_host -P your_company_proxy_port-u username -a password ---- Worked Fine
I didn't try the 2nd option.
Thanks for solving another

How to send test results (CSV file) in Jmeter through Email after Test Run

Please provide the solution for how to send test results (CSV file) in Jmeter through Email after Test Run.
How to schedule the test for particular time and send mail automatically
Awaiting for your response
Add the next line to user.properties file (located in the "bin" folder of your JMeter installation)
jmeter.save.saveservice.autoflush=true
Add tearDown Thread Group to your Test Plan
Put SMTP Sampler under the tearDown Thread Group, configure SMTP server details, credentials, etc. and set it to send testresult.csv as the attachment. See Load Testing Your Email Server: How to Send and Receive E-mails with JMeter for more information and some example configuraiton.
Run your test in command-line non-GUI mode like:
jmeter -n -t yourtest.jmx -l testresult.csv
That's it, JMeter will run your test and send results via email upon test completion.

Resources