Apache JMeter 5.5 - Need to use a specific range as Data value from a CSV file - loops

I am currently using JMeter 5.5 and I have the below data set stored in a .csv file
BatchId
DocID_Start
DocID_End
1
1
93
2
94
1266
...
...
...
7
25313
45700
Each BatchID has 'n' number of Document ID ranging between DocID_Start and DocID_End.
I am trying to create a sampler that sends a POST Drop loop Call to the API ${url}/drop?documentIds=${DocID}
where DocID is any number between the DocID_Start and DocID_End.
I Created a the following testplan
GET Batch is working as expected and it is looping through each of the BatchID within the CSV file one by one but I could not get POST Drop Loop to go through the CSV and grab a different DocID_Start value. It will just keep reusing the first line for every user.
I've tried using Loop Counter and ticked off different checkboxes but i couldn't get it to work

With the default Sharing Mode of All threads CSV Data Set Config reads the next line from the CSV file on each iteration of each virtual user.
If you want to get a random number between DocID_Start and DocID_End - go for __Random() function:
${__Random(${DocID_Start},${DocID_End},)}
you can call this function as many times as you want under the Loop Controller.
If I misunderstood your question and you want to proceed to the next "Batch" under the Loop Controller - you need to move your CSV Data Set Config inside the Loop Controller as currently it proceeds to the next line on the new iteration of the Thread Group. JMeter Scoping Rules documentation chapter can shed some light on this.

Related

Logic app how to check sftp has file after, 5 min if file is not present

I have a scenario where a Logic App will be scheduled to run at 11 am everyday and will move file from one SFTP to another SFTP, which I have done.
I want to add a condition if the first time the file is not present on SFTP then it should check again after 5 min for 3 retry attempts.
Thanks in advance.
I want to add a condition if the first time the file is not present on SFTP then it should check again
In order to check if the file is present or not, you can use List files in folder action.
Then you can check for file's existance by looping through files inside that folder using DisplayName Variable.
I want to add a condition if the first time the file is not present on SFTP then it should check again after 5 min for 3 retry attempts.
Whereas For the above requirement, when you want to retry you can use until Action of Control Connector.
Then set its count to 3 from Change Limits. Below is the flow in my Logic app
In the next step you can use Delay action and set its limits to 5 minutes.
So that for every 5 minutes the flow is going to check whether the file is present or not in sftp for 3 times.
Below is the whole flow that satisfies your requirement.

How to iterate a request dynamically for each user in JMeter

I need to iterate a request multiple times in JMeter for different users. The iteration number differs for each users. For example: I need to iterate a request 5 times for first user, 3 times for second user and only 1 time for 3rd user and so on. How can we do this and how the input can be fed to the same. Is it possible to say read first 5 line for first user and next 3 lines for second user in csv data set config.
You can define the desired loops count for each user in the CSV file or via JMeter Properties
You can read the desired line from the CSV file using __groovy() function like:
${__groovy(new File('test.csv').readLines().get(0),)} - read 1st line
${__groovy(new File('test.csv').readLines().get(1),)} - read 2nd line
etc.
Here is a solution for your problem. There could be many other solutions available in JMeter.
You can define the loop count associated with the users (threads) in a (User Parameters)enter link description here Pre-processor.
This panel allows you to specify a series of values for any User Variable. For each thread, the variable will be assigned one of the values from the series in sequence. If there are more threads than values, the values get re-used.
Then the requests can be placed within a Loop Controller
The User Parameters component shall be placed within a JSR223 Sampler to ensure the values are initiated before the loop controller is reached. Also the JSR223 Sampler shall be placed within a Once Only Controller to ensure the Sampler is executed only once.
Add SampleResult.setIgnore() in the JSR223 Sampler to avoid the sampler getting recorded into the test results.
Test plan structure
CSV Data Set Config more suitable for large numbers of parameters

Automation Anywhere Excel Loop

Does anyone know of an easy way to start an excel loop in Automation Anywhere at a row other than 1? (or two by using contains header option). I would like to start a loop at row 5 but everything I have tried thus far does not work.
Thanks in advance.
You can use the command - Go to Cell under Excel commands as explained below.
If you want to start from 5th row and 'A' column then before starting the excel loop:
Open spreadsheet
Select Go to Cell Command under excel commands
Select Specific Cell radio button
Provide the value of the Specific Cell as'A5'(which denotes 5th row and 'A' column)
Reference:
How to write data to excel file in a loop starting from a specific cell
Assign a loop count to a variable and if loop count is less than your desired row, continue the loop.
You can do this very easily using the "Continue" command. When you are looping in the excel using "Each row in an excel Dataset", make use of system variable "counter". Since you want to start from row 5, that means you will have to skip the first 3 lines as you have marked the contains header as yes. Use the condition "if counter < 4 then continue" which will skip the first 3 lines.
See below image for reference
There are couple of ways you can go about it,
♦defining counter would be one way to go about it.and loop starts after 5.
♦you can use specific cell to begin your task and use times for loop(rest of the rows) and can iterate to rest of the rows.
♦other is run a smaller task where it would copy all cell from row 5 to a new sheet and you can use generic excelloop to do the same task.
[this sheet can also be used to input something like "Success" and timestamp when loop finished that row to know its completed.]
Look at this. I can tell you about G1ANT as I have worked on that. Just change the value of from, your excel loop will start from that value only.
addon msoffice version 4.101.0.0
addon core version 4.101.0.0
addon language version 4.103.0.0
excel.open ♥environment⟦USERPROFILE⟧\Desktop\tlt.xlsx inbackgound true
for ♥n from 5 to 100 step 1
excel.getrow ♥n result ♥rowInput
dialog ♥rowInput
end
you cam use Excel Command.
Excel Command
1. Go to cell.
2. select your Excel Session
3. select specific Cells
If you use Excel command in Loop Command
you can use System variable "$Counter$"
And set Excel Command's select specific Cells to A$Counter$ / B$Counter$ etc.

Auto-generating destinations of split files in SSIS

I am working on my first SSIS package. I have a view with data that looks something like:
Loc Data
1 asd
1 qwe
2 zxc
3 jkl
And I need all of the rows to go to different files based on the Loc value. So all of the data rows where Loc = 1 should end up in the file named Loc1.txt, and the same for each other Loc.
It seems like this can be accomplished with a conditional split to flat file, but that would require a destination for each Location. I have a lot of Locations, and they all will be handled the same way other than being split in to different files.
Is there a built in way to do this without creating a bunch of destination components? Or can I at least use the script component to act as a way?
You should be able to set an expression using a variable. Define your path up to the directory and then set the variable equal to that column.
You'll need an Execute SQL task to return a Single Row result set, and loop that in a container for every row in your original result set.
I don't have access at the moment to post screenshots, but this link should help outline the steps.
So when your package runs the expression will look like:
'C:\Documents\MyPath\location' + #User::LocationColumn + '.txt'
It should end up feeding your directory with files according to location.
Set the User::LocationColumn equal to the Location Column in your result set. Write your result set to group by Location, so all your records write to a single file per Location.
I spent some time try to complete this task using the method #Phoenix suggest, but stumbled upon this video along the way.
I ended up going with the method shown in the video. I was hoping I wouldn't have to separate it in to multiple select statements for each location and an extra one to grab the distinct locations, but I thought the SSIS implementation in the video was much cleaner than the alternative.
Change the connection manager's connection string, in which you have to use variable which should be changed.
By varying the variable, destination file also changes
and connection string is :
'C:\Documents\ABC\Files\' + #User::data + '.txt'
vote this if it helps you

jmeter: how to use while loop inside a loop

my JMeter plan is
-- Loop controller (set to 3)
-- while controller(set to "${Dataitems}" != "<EOF>")
-- using CSV for reading the data items
-- HTTP requests
now issue is that after completing the while loop , thread is getting stopped . I know this is controlled in CSV config "Stop thread on EOF" =true will make thread to stop. But my requirement is that after iterating through my csv , I want control to passed to outer loop which will run based on the variable i provide in my case 3 so all request will run for all the data items i provide in csv for three times.
To achieve i tried to set
"Stop thread on EOF" = false , then its started running lopp for intinte times
"Stop thread on EOF" = ${Var1} , where var1 was declared in test plan , but still loop was running infinite times
Can some provide an insight on how to handover control from while loop to outer loop?
Your help much appreciated.
As you know, While controller will keep running until the condition fails.
Unfortunately, in your case, you need to set below condition to reiterate the CSV file values.
'Recycle on EOF?' to TRUE
So, While controller will never exit as you can not use any condition there (to fulfill your requirement).
The only way I can think to make your requirement work is - to use 2 Loop Controllers.
(Outer) Loop Controller (set to 3 as you had said)
(Inner) Loop Controller (set to no of rows in CSV)
I get the output like this. My CSV file has 3 rows with the values A,B,C. They are called 3 times by the outer loop controller.
If you do not want to hard code the number in the loop controller, use a variable & find the no of rows using beanshell and set the value to the variable.

Resources