Bad Encoding or Strange Characters in Jmeter HTTP Request POST Option - jmeter

I have been trying to record session and I got some "bizarre" characters in the POST Option in the HTTP Request component. I need some MAGIC Advice with this(picture).
Stranges Characters Appear in the POST Option in the HTTP Request component
That's it, as you can see, Jmeter in the recorded session, put me Characters that I don't understand. I seen 1000000 videos and in all of those videos the tool always show the information with no problems.
I alreade try to put utf-8 in the "Content Encoding" also change the jmeter.properties file enabling the "sampleresult.default.encoding=utf-8" option, In FACT, I try to edit the proyect modifying the ApacheJMeter_http.jar file (I found in the file that still using encoding=ISO-8859-1). I dig in almost all sites looking for a solution and I found NOTHING that can help me to fix this and I have to buils a report for my jobs next week. Please any help will be appreciated.
my Best
PG

Switching to "Parameters" tab of the HTTP Request sampler will not work given you have something in the "Body Data" tab no matter which "encoding" is being used
I don't think your goal is to test https://ocsp.digicert.com/, my expectation is that you need to exclude this domain from your testing scope
Just in case you don't need to recompile or reverse engineer anything, the "encoding" of JMeter HTTP Request samplers can be controlled either using the relevant field:
or by manipulating the relevant JMeter Properties

Related

JMeter - Error when using __FileToString to set GraphQL request body

(this is a dummy example with SWAPI)
I'm trying to set my body based on what is in a file and it fails saying the JSON is invalid. But when I set the request body manually the same content the request works.
In the results tree view I can see that the only difference is that the manual request is "encoded", it has /n instead of visual newlines.
Here's the request that fails (body coming from file):
Here's the request that works (body manually set):
does anyone know a way to force this "encoding" when retrieving the query string from a file?
It looks like a limitation or bug of the GraphQL HTTP Request sampler, you might want to raise it via JMeter Bugzilla
In the meantime you can consider manually changing line breaks to \n using __strReplace() function, something like:
${__strReplace(${__FileToString(${fileName},,)},\r\n,\\n,)}
should do the trick for you.
You can install __strReplace() funciton as a part of Custom JMeter Functions bundle using JMeter Plugins Manager
More information: How to Use the Custom JMeter Functions Plugin
I've opened a bug for Apache and they acknowledged this behavior but it doesn't seem like something they'll fix soon.
I came up with a solutions that is close to what #Dmitri T suggested but without using any Plugins
I've created a JSR223 PreProcessor (Language: Groovy) that will replace the special characters that might break the request's JSON. So far the things that I've seen in GraphQL that might break it are new lines and double quotes.
def content = new File(vars.get('fileName')).text;
vars.put('queryContent', content.replaceAll(/(\r\n|\r|\n)/, /\\n/).replaceAll(/"/, /\\"/))

Jmeter Issue: # is getting replaced by %40 when trying to read data from CSV

I have a scenario where I want to read the data from CSV file and use the same in a POST request. The email data contains '#' symbol.
So, when I try to hit the API using Jmeter '#' is getting replaced by '%40'. I tried below solutions but it didn't worked out:
Uncheck 'URL Encode' checkbox
Used __urldecode function -> ${__urldecode(abc#xyz.com)}
Result:
I don't think JMeter converts anything, it should send POST request parameters as they are, what you see in the View Results Tree listener is the textual representation. You can use a sniffer tool like Wireshark to see what exactly JMeter sends:
If you switch to HTTP tab you should see that the username is sent with # symbol
If you have troubles building your HTTP requests manually consider recording just recording the request(s) using either HTTP(S) Test Script Recorder or JMeter Chrome Extension, both should produce syntactically correct HTTP Request samplers.

Can Charles map incoming request using saved session?

In my team, QA will test the application, if there's a bug, QA will record a charles session and provide the file to developer.
Now as a developer, I want to quickly reproduce the bug. Currently what I do is manually save the response, then use the "map local" tool to create a "map local" relationship between the request and response.
But it's tedious and cumbersome if there're multiple requests I need to mock. I'm thinking is it possible just simply tell charles, "hey charles, Use the current recorded session as source, if any future request match one of the recorded request, just use the recorded response. if none request match, let it pass through".
Then when I get a charles session file, it'll be very easy for me the set up the mock response. I can start troubleshooting the bug in just seconds.
I'm not sure if this can help but basically, if QAs spot any bugs, they can use the "export flow" feature and then share with you these exported files. When you import such files, you would be able to reproduce quickly without setting up as the request/ response have already been saved.
However the tool I'm using is Proxyman instead of Charles. You can find the detail instruction at
https://proxyman.io/blog/2019/07/How-I-use-Proxyman-to-report-bugs-more-effectively.html. Hope it helps!

How to submit an HTML Post Request with JMeter to an oracle-apex website

I am encountering an issue with Jmeter when attempting to stress test an oracle apex website. The issue I'm having is stemming from an ajax issue.
With Jmeter I am trying to simulate a button click on page one of an application with an HTTP Post Request on the page:
/Capps/wwv_flow.ajax
I am passing in the following variables:
p_flow_id 101
p_flow_step_id 1
p_instance ${sessionid}
p_request PLUGIN=ijiPvZ-iJYfT0ihaQKUMZz3Lcjg8SHOXpMeHDzckC5k
p_json {"pageItems":null,"salt":"258015622351528748546171137179439761614"}
The first three are the applicaiton number, page number, and sessionid (the sessionid was retrieved in a earlier step using a regex extractor) Also, the p_request and p_json are encoded.
I noticed from using chrome in developer mode that the p_request string and
the last part of the p_json string often change with each run through of the button click
I was unable to find any information online that could help explain this occurs so that I could find a solution to simulate the button click.
Note I am having a similar issue on another page where I attempt to submit a simple form.
Any assistance would be greatly appreciated, thank you,
Zac
Looking into Configuring Apache JMeter for Apex article it seems you need to correlate these p_request and p_json parameters in exactly the same manner as you do for p_instance (assuming different relevant Post Processors of course)
Alternatively you can record your test scenario using a cloud-based proxy tool which is capable of exporting recorded scripts in "SmartJMX" mode with automated correlation of all detected dynamic parameters applied, check out How to Cut Your JMeter Scripting Time by 80% article for more details.

jmeter regarding performance and load testing

Let me describe the issue which i have been facing.
i want to do performance and load testing on our internal website. which has login and other functionalities.
the issue i am facing that when i hit 12 or any number of request using http sampler then i am getting same response from all the 12 request. But actual scenario is that webpage displays different data for different page.
I checked using firebug and everything is working fine over there using correct response from request but when i use jmeter i am using same response from every request.
Please let me know if anybody had faced same kind of issue of is there anything i am doing wrong in configuring script.
Try to add HTTP Cookie Manager to your test-plan to the root (Test Plan) node or to the Thread Group node.
As per jmeter documentation:
The last element is a HTTP Cookie Manager. A Cookie Manager should be
added to all web tests - otherwise JMeter will ignore cookies. By
adding it at the Thread Group level, we ensure that all HTTP requests
will share the same cookies.
Ensure that parameters values that are dynamic are not hard-coded (after recording jmeter scripts, for example): no hard-coded JSessionID values in your HTTP requests, e.g..
Ensure you don't miss any necessary params in your HTTP requests.
JMeter does not process Javascript or applets embedded in HTML pages.
Your problem may be caused by this feature.
As per jmeter documentation:
JMeter does not process Javascript or applets embedded in HTML pages.
JMeter can download the relevant resources (some embedded resources
are downloaded automatically if the correct options are set), but it
does not process the HTML and execute any Javascript functions.
If the page uses Javascript to build up a URL or submit a form, you
can use the Proxy Recording facility to create the necessary sampler.
If this is not possible, then manual inspection of the code may be
needed to determine what the Javascript is doing.
I would also recommend your to look first into Jmeter reference before further scripting activities - this may prevent from some faults and frustration.
At least these:
Building a Test Plan
Elements of a Test Plan
Building a Web Test Plan
Building an Advanced Web Test Plan
Hope this helps.
I would suggest - Use Jmeter's Regular Expressions. You may be able to resolve this issue with RegEx. Post using regex, use 'View Results Tree' listener to check if you are getting apt response for each of your threads.
You can also analyze your results using Blazemeter's listener that gives you more insights into your test.

Resources