How can I resolve this Session ID problem in Jmeter? - jmeter

I am working on a Jmeter login script. To create this script I used blazemeter. The thing is that it is not working correctly as I get a http 403 response code.
Thanks to fire fox I know that in my header I need to send the next data whenever I do a GET to the web page:
This is how I do it in JMETER:
Extractor:
This is the response:
The problem I am having is that the session id is not working correctly. I dont know if this is the problem why I have a 403 response code but it is still a problem. I tried everything to solve this error code but I failed so I need to start from the beginning
Look at this:
Do you have any suggestions to resolve this problem of the sesison id? If you do, I would really appreciate it
UDPATE:
I changed the variable in the petition because I was naming it wrong but I am still having issues. No id appears:

You're trying to extract Cookie value from the response message, switch the Regular Expression Extractor to the Response Headers (Cabeceras) and your approach should start working:
Also be aware that you don't even need the Regular Expression Extractor.
Add the next line to user.properties file:
CookieManager.save.cookies=true
Restart JMeter to pick the property up
Add HTTP Cookie Manager to your Test Plan
In the HTTP Header Manager (Gestor de Cabecera HTTP) refer the extracted value as ${COOKIE_GX_CLIENT_ID}

Related

Jmeter API testing using csv input as post request in localhost

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.

Immediate help required - Getting error 403 and 500 in jmeter

I am working with Jmeter to do load testing. I created a simple login script using BlazeMeter. Then I imported the file into Jmeter.
Whenever I try to run the script, it fails. The problem I encounter here is that 2 of my https requests I receive a 403 and 500 response code.
enter image description here
Output
I added an HTTP Authorization Manager to try and solve this but it is not working. Do you have any suggestions on how to resolve this?
I tried adding post processors but couldn't make them work.
First of all Template value in the Regular Expression Extractor should be $1$
Also your regular expression itself looks kind of weird and I doubt it matches anything. You can check whether it generates the proper ${state} variable by using Debug Sampler and View Results Tree listener combination
In general using regular expressions for parsing HTML is not the best idea, it worth considering migrating to CSS Selector Extractor

Jmeter 5.4.1 failing for 500 response - Internal Server Error - while trying to login

I have recorded script by using Blazemeter. It worked fine for the first day. Now when I am running the same jmx file, it gives me Response code 500.
Please help me to understand what I did wrong.
Sampler Result:
This is how my parameters are posted at login.
BodyData tab does not open for me.
Login parameters:
When you say that it ran successfully yesterday and today it is failing, there is some parameter like session / token that was valid for like 12 hours / 24 hours and now it has expired. You will need to identify that and parameterize it. I cannot help you much right now as I don't know what is that variable value and how does it differ each day. Perhaps checking with developers will help.
It seems you're trying to test a secure web service and most probably there is a current timestamp included somewhere in your request body so the request was passing when it was more or less "recent" and after some time the request became invalid due to expiration.
I cannot state where exactly the problem is and how to fix it by looking at partial screenshot so I can give you only a generic piece of advice: consider using WS-Security Plugin for JMeter for adding the relevant SOAP header containing up-to-date information like timestamp and eventually a signature.
More information: Running SOAP WS-Security Load Tests in JMeter

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:

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