Sending data whose last character is dynamic in JDBC Request - JMETER - jmeter

I have a question in Jmeter!
I have a script in a JDBC request (INSERT).
One of the data must be dynamic. Each time I call, the last character of the data must be sequential (1, 2, 3, 4, 5...). Example "XXXHDLALA01", "XXXHDLALA02", "XXXHDLALA03", etc.
The data would be the same every time I insert, but I would only change the last characters, because they are sequential numbers.
The data is as follows:
ACTC104_04358798_20220202_00001
I need to change only the last one (ACTC104_04358798_20220202_00001, ACTC104_04358798_20220202_00002, ACTC104_04358798_20220202_00003, ACTC104_04358798_20220202_00004...)
Can I do this using some kind of regex?
Thanks in advance!

Check out Counter configuration element
If you add Counter and configure it as:
In the JDBC Test Element use ${counter} as the postfix for the dynamic part:
ACTC104_04358798_20220202_${counter}
Demo:
You may also want to use __time() function as well because 20220202 looks like current date to me
ACTC104_04358798_${__time(yyyyMMdd,)}_${counter}
More information: How to Use a Counter in a JMeter Test

Related

How to correlate different values in a RegEx with multiple matches with JMeter- Correlation Recorder?

I have a problem in JMeter that I can't figure out how to solve.
Situation:
I want to load test an ASP.NET-website.
bzm - Correlation Recorder used for recording and correlation
ScriptResource and WebResource have multiple occurrences
Now I used following RegEx to extract the ScriptResource values: <script src="(.+/ScriptResource.+?)". Then I stored the 3 matched values into 3 different variables. But I can't replace the values in the found order.
Example:
First Match: stored in : AspNet_ScriptResource
Second match stored in: AspNet_ScriptResource_1
Third match stored in: AspNet_ScriptResource_2
The three matches have all different values, can't paste one value into all 3 matches.
So I have to write the value from AspNet_ScriptResource into the first match (matchNr=1).
AspNet_ScriptResource_1 into second match (matchNr = 2) and
AspNet_ScriptResource_2 into third match (matchNr = 3).
But in the Correlation Rules (in the Correlation Recorder) in the "Correlation Replacement" section, there is no option to choose in which matchNr to write.
Correlation Recorder: Correlation Rules
I tried to use a BeanShell Preprocessor with a for-loop but I only found a way to write in the logs, not in the response body.
Is there a way to solve this with the Correlation Recorder plugin? If not, what options do I have to handle such a scenario?
Thanks for your help! :)
You can raise an enhancement request for the bzm - Correlation Recorder via JMeter Plugins support forum or if you're a BlazeMeter customer and need this piece of functionality asap - you can open a support ticket for implementation of the feature.
Currently it seems that the Correlation Recorder expects you to provide a regular expression either with the unique match or you will have multiple substitutions with the same value.
With regards to Beanshell approach:
You can substitute response data, but not with the PreProcessor, you need to do this via the PostProcessor using prev.setResponseData() function
Since JMeter 3.1 you're supposed to be using JSR223 Test Elements and Groovy language for scripting
If you need to change request data, not the response data, you can do this via sampler.getArguments() function

How to get the interval between two time values

In my database I have two columns. First is called starting and the other isending. Both are formatted like 11:00. How to get the interval between ending and starting.
I have tried whereBetween, but it didn't work as I think.
You can use Carbon to get the difference, it offers a number of functions for calculating time differences. For example:
$end->diffInSeconds($start);
$end->diffInHours($start);
$end->diffInDays($start);
Those are just a few, see the docs for more examples
you have two methods first you can use double where like
$blablabla= Category::
where('starting','<=','your variable here')
->where('ending','>=','your variable here')
->first();
second method
whereRaw with bindings, where you use the raw condition and a binding for the variable:
whereRaw('? between starting and ending', [$yourVariable])
BOUNCE
wherebetween is for check the column value between two given values (intervals)
not the opposite you wanna check given value between two columns

In JMeter script how to pic a random item from drop down list

I had a scenario like I need to select one random date range from drop down list of values(like today, yesterday, last month etc). How should i select one value randomly every time from the drop down list.waht function or method i need use in my jmeter script.Any one please help me. Thanks in advance
The easiest way to get this done is using HTML Link Parser, refer Poll Example user manual entry for more details, basically you need to provide input name and a wildcard like .* and JMeter will automatically scan the possible options and pick up a random value.
Other option (if the above one is not applicable for some reason) is using XPath Extractor or CSS/JQuery Extractor to get the possible dropdown values from the page DOM, Match No. parameter set to 0 will return the random option value.

What means "Name=SWEIPS" Parametr in Siebel

Writing script in LR for Siebel Open UI. All my requests contains this parameter, with different values. What does it mean?
Examples (from different requests):
"Name=SWEIPS", Value = #0'0'1'0'GetProfileAttr'3'attrName'SBRF Position Id'"
"Name=SWEIPS", Value = #0'0''0'3'1-SQE21A, 1-SQL21E, 1SQE31"
And so on.
Can I simple delete it?
Can I simply delete it? - No, you’re not supposed to delete it.
Compare SWEIPS value by recording twice or trice with different data sets, check is there any date/time values in SWEIPS. If there is nothing to correlate leave as it is, no need to delete.
Ensure to correlate values like SWET,ROWID,SWECount,SWEC and so on.

Is it possible to include jmeter variables in values obtained from CSV?

I have a csv file which contains a column named "query". One of the entires I have for query is /user/${id}/list/${list}.
What I would like to do is let jMeter overwrite the ${list} and ${id} variables in the query when it is passed to a HTTP Sampler with variable values already in use from previous steps in my test plan.
For example:
In test plan, create ${id} = 5 and ${list} = 10.
In test plan, open csv file that contains query string.
In test plan, perform use a HTTP Sampler. Path in query should be the query value passed from csv file.
3a. Jmeter should take query passed to sampler and replace ${id} and ${list} with the values stored to those variables within test plan (5 and 10).
Right now when I try this, the HTTP response comes back showing the request was made to /user/${id}/list/${list}, not /user/5/list/10.
Does anyone know how to force the substitution through jMeter?
Is it even possible?
I was able to figure this one out after a bit of head scratching.
JMeter allows you to overload variables (place references to variables within a variable) by using the __eval function.
To get around the issue, I left the csv file as is, with references to variables set. When I wanted to reference the query from the csv file and overload the variable placeholders with actual values I used ${__eval(${query})} - where query = the
Try to use __eval function instead:
/user/${__eval(${id})}/list/${__eval(${list})}
__eval function seems to be just your case.

Resources