Value cannot be null: Parameter: Source error received from JMeter - jmeter

I have been receiving this error message on particular request - "Value cannot be null. Parameter name: source".
My Scenario is that 1 user will be transacting 5 transaction (Search and Remit). I'm targeting to run 650 Users to 3250 Transaction. The problem is that one particular request which is getting details from the DB, some data is passed but mostly are the mentioned error message above.
I Have 2 CSV Config, 1 from Users, the 2nd is for the Data where the second csv is inside the Loop Controller.

Your application tells you that the request is not correct, it expects a value and you're failing to provide the value. Use Debug Sampler and View Results Tree listener combination to validate the values of the JMeter Variables which are being sent for successful and not successful requests, it might be a test data issue, for example an extra comma in the CSV file will make CSV Data Set config "think" that this is the delimiter for the next column.

Related

JMeter - Pause the request if it gives an error

I'm using Apache JMeter to send thousands of HTTP requests with 3 seconds of delay in between. The response body is json and starts with {"errors":[ ], ...}. If there is an error it will be in the [ ]. If there is no error than [ ] will be empty.
I want JMeter to pause for a short period of time if it receives an error, and try the request again. So that it'll add in additional buffer when needed.
Do I need a script for this? How can I achieve this?
You can get the number of errors by adding a JSON JMESPath Extractor as a child of the Sampler which returns the JSON and configuring it like:
It will extract the number of entries in errors JSON Array and store it into errors JMeter Variable
Then you can use If Controller to check if the number of errors is above zero, it can be done using __jexl3() function like:
${__jexl3(${errors} > 0,)}
and finally you can introduce a delay using Flow Control Action sampler:
Solution 1
Add a JSR223 Post Processor to the Test Plan level, Thread Group or to a sampler based on your requirement.
Add following code into the script area to check the error and introduce a delay after error if any.
int delayOnErrorInMillis = 5000
if (prev.getResponseDataAsString().startsWith('{"errors":')){
log.info("ERROR !")
sleep(delayOnErrorInMillis)
}

JMETER nested while loop is stopping at first line of the CSV data file

I have to make a GET call on IDs stored in a CSV while and I have to retry on GET call till it returns 200 response code.
This is what my current structure looks like ..
GET thread group
Once only controller to grab authentication for each thread
While Controller with condition "${__javaScript("${index}"!="<"EOF">")}" to check for end of the CSV
file
CSV data config file (Each file is unique for each thread) , variable name is "index", Recycle on
EOF - False, Stop thread on EOF - True,
sharing mode - current thread
While Controller with condition "${__javaScript(parseInt(vars.get("Response_code"))!=201)}"
User defined variables - Response_code
Http GET request
JSR233 post processor - "vars.put("Response_code",prev.getResponseCode());"
JSR223 post-processor - To write ID returned in successful call to another CSV file
Now I am not getting error or anything .. but I was expecting first while controller to loop through CSV file for each id, then make a GET request for each id and then second while loop would wait for success code but for some reason, GET call is only executing for the first entry in the csv and then exit out of it. What am I missing here?
CSV data config file (Each file is unique for each thread)
this is not how it works, the CSV Data Set Config is being initialized once with the filename resolved at the time of its execution, it doesn't load the new CSV file for each virtual user.
If you're looking for an option of supplying the CSV file name(s) dynamically in the runtime - consider switching to __CSVRead() function. See How to Pick Different CSV Files at JMeter Runtime article for more details.

How can run JMeter with limited CSV login details for multiple threads ?

Im just trying to run my JMeter script for 20 threads. I'm use CSV data set config for read login data. I set there are only 5 login details in CSV file. When i run the script only first 5 request got pass and rest of the thread request got fail. Anyone can suggest a solution. Thanks.
Apply the following configuration to your CSV Data Set Config:
Recycle on EOF - True
Stop thread on EOF - False
When JMeter reaches the end of the CSV file it will start over so 6th thread will get <EOF> as the value, 7th thread will pick 1st line, 8th thread will pick 2nd line, etc.
You can put your login request under the IF Controller and use the following condition:
"${line}" != "<EOF>"
to avoid the login failure due to this <EOF> variable value.

Running JMeter in Command mode is not creating any log for anything under while loop in .jmx file

I have a .jmx file with two thread groups. The first thread group is for data comparison (DB Vs API) and has a JDBC request where I plugin my SQL script and saves it to a tab delimited file. Then I have a while loop under which I have an HTTP request.
Second thread group for negative scenarios validation.
Below is the structure of the .jmx file
-- Thread Group Name - FX-Rates
-- JDBC Request Name - FX-SQL
-- While loop
-- HTTP Request - FX Rates - API
-- Thread Group Name - Negative Testing
-- Error Codes
I am running JMeter in Non GUI mode using below command.
jmeter -n -t "F:\MY DOCUMENTS\PSM\PSM_Automation\bin\Non_GUI_FX_Rates_Validation.jmx" -l "F:\MY DOCUMENTS\PSM\PSM_Automation\log\Non_GUI_FX_Rates_Validation.jtl"
I see that it is creating log for each individual sampler i.e; SQL and negative scenarios but not for anything under while loop. Below is the log that it created.
Logfile:
timeStamp,elapsed,label,responseCode,responseMessage,threadName,dataType,success,failureMessage,bytes,sentBytes,grpThreads,allThreads,Latency,IdleTime,Connect
1492185939615,12140,FX - SQL,200,OK,FX Rates 1-1,text,true,,18549,0,1,1,12017,0,1566
1492185951933,0,Error 400: Invalid Date Format,Non HTTP response code: java.net.URISyntaxException,Non HTTP response message: Illegal character in query at index 80: https://sys-fxrt-v0.apps.system.pcf.ntrs.com/foreign-exchange-rates?as-of-date=${D_EXCH_RT_EFF},Negative Testing - Error Codes 2-1,text,false,,1105,0,1,1,0,0,0
1492185951935,190,Error 404: No Account,404,Not Found,Negative Testing - Error Codes 2-1,text,true,,354,232,1,1,189,0,170
1492185952127,20,Error 404: Incorrect URL,404,Not Found,Negative Testing - Error Codes 2-1,text,false,,354,241,1,1,19,0,12
1492185952147,19,Error 204: No Data ,404,Not Found,Negative Testing - Error Codes 2-1,text,true,,354,260,1,1,19,0,12
Obviously, the kind of sampler result is there:
Error 400: Invalid Date Format,Non HTTP response code: java.net.URISyntaxException,Non HTTP response message: Illegal
character in query at index 80:
https://sys-fxrt-v0.apps.system.pcf.ntrs.com/foreign-exchange-rates?as-of-date=${D_EXCH_RT_EFF}
Obviously that is because the D_EXCH_RT_EFF is not set/resolved in your URL.
That's the problem you're gonna debug.
Obviously.
If you're already doing that (debugging), and run into a problem during it - then describe it please.
And show two things: how you set (initialize) the variable; how you use it, means, literally, show your HTTP sampler (yes, screenshot, at least).
The reasons of not entering the "While Loop" can be in:
While condition is returning false
While condition is wrong
If your While Condition depends on a variable coming from JDBC Request Name - FX-SQL sampler - double check this variable value using Debug Sampler and View Results Tree listener combination.
General "good practice" is running your test with 1-2 virtual users in GUI mode and inspect requests and responses details in the View Results Tree listener. Also pay attention to any suspicious entries in jmeter.log file. Don't run your JMeter test with the full load until you are totally sure that it is doing what it is supposed to be doing. See How to Debug your Apache JMeter Script article for more information on JMeter tests troubleshooting techniques.

JMeter variable scope in threads

I have a JMeter tests which does the following:
It makes a GET request. The request returns some ID which is extracted by a Regular Expression Extractor and is set to a variable myId.
Another GET request is made using this ID stored in myId. It is important that the same ID is used as returned by the request before. Not any other ID!
This simple scenario works fine. But when I increase the "Number of Threads (users)" from 1 to (let's say) 5, I run into concurrency problems:
Thread 1 makes the GET request and assigns the ID to myId.
Thread 2 makes the GET request and assigns the ID to myId.
Now thread 1 runs again and makes the second GET request but with the wrong ID as thread 2 has changed it. Now everything breaks.
How can I avoid this?
As you use the same name for the reference myId, if in the second extraction it doesn't find anything then myId will contain the previous extracted value.
What you can do to check this, is to put in Default Value field:
nv_myId
as per:
http://jmeter.apache.org/usermanual/component_reference.html#Regular_Expression_Extractor
You can use a Debug Sampler to show content of variables

Resources