is there a way to start to read where we stop in CSV Data Set Config in JMeter? - testing

I have created a test that reads the users from a CSV Data Set Config in JMeter.
For example when i run a test, JMeter reads first 20 users in the CSV file.
Then if i will run the same test again, JMeter again reads the first 20 users in the CSV file.
But i want JMeter to read 20 users but must start the reading from 21st user, and so on.
Is there a way to make this possible?

As per CSV Data Set Config documentation:
By default, the file is only opened once, and each thread will use a different line from the file. However the order in which lines are passed to threads depends on the order in which they execute, which may vary between iterations. Lines are read at the start of each test iteration. The file name and mode are resolved in the first iteration.
So there is no way to specify the "offset" for reading the file, the options are in:
Use __CSVRead() function where you can call ${__CSVRead(/path/to/your/file.csv,next)} as many times as needed to "skip" the lines which are already "used"
Use setUp Thread Group and JSR223 Sampler to remove first 20 lines from the CSV file programmatically
Go for Redis Data Set config instead where you have Recycle Data on Use option, if you set it to False the "used" data will be removed

Related

How to parameterize values in the csv file which is already parameterized in Jmeter

I have multiple API request bodies and Im passing them using txt file in CSV Data Set Config. This API request bodies have certain values to parameterize. How Do I acheive this? something like paramertize inside parameterized csv file.
If your CSV file contains JMeter Functions or Variables which you want to evaluate in the runtime you need to wrap the variable(s) defined in the CSV Data Set Config into __eval() function
For example if you have:
test.csv file with the single line containing ${foo} and CSV Data Set Config reading this file into some-variable
User Defined Variables which assigns the variable foo the value of bar
And a couple of Debug Samplers for visualization
You will see that:
${some-variable} will return ${foo}, basically the line from the CSV file
${__eval(${some-variable})} will return bar because the variable will be evaluated and its respective value will be resolved.

How to configure/capture 'failureMessage' to the result file in Jmeter

I have a jmx script which saves the results to a CSV file.
I need to see the 'failureMessage' field in the CSV especially when the 'success' column says 'false' as in the below example. But the failureMessage column always appear as blank irrespective in the csv
Example -
timeStamp|time|label|responseCode|threadName|dataType|success|failureMessage
02/06/03 08:21:42|1187|Home|200|Thread Group-1|text|true|
02/06/03 08:21:42|47|Login|200|Thread Group-1|text|false|Test Failed: expected to contain: password etc.
I tried looking up the jmeter.properties file to check the below which is set to true. But it still doesn't save the message to failureMessage in the csv.
assertion_results_failure_message only affects CSV output
jmeter.save.saveservice.assertion_results_failure_message=true
I cannot reproduce your issue using:
Latest JMeter 5.2.1
With the default Results File Configuration
Running JMeter in command-line non-GUI mode
Demo:
If you cannot see custom assertion failure messages your setup violates at least one of the above 3 points.
Try adding assertions with your requests and you will find it in your results in case of assertions getting failed.

Split CSV file in records and save as a csv file format - Apache NIFI

What I want to do is the following...
I want to divide the input file into registers, convert each record into a
file and leave all the files in a directory.
My .csv file has the following structure:
ERP,J,JACKSON,8388 SOUTH CALIFORNIA ST.,TUCSON,AZ,85708,267-3352,,ALLENTON,MI,48002,810,710-0470,369-98-6555,462-11-4610,1953-05-00,F,
ERP,FRANK,DIETSCH,5064 E METAIRIE AVE.,BRANDSVILLA,MO,65687,252-5592,1176 E THAYER ST.,COLUMBIA,MO,65215,557,291-9571,217-38-5525,129-10-0407,1/13/35,M,
As you can see it doesn't have Header row.
Here is my flow.
My problem is that when the Split Proccessor divides my csv into flows with 400 lines, it isn't save in my output directory.
It's first time using NIFI, sorry.
Make sure your RecordReader controller service is configured correctly(delimiter..etc) to read the incoming flowfile.
Records per split value as 1
You need to use UpdateAttribute processor before PutFile processor to change the filename to unique value (like UUID) unless if you are configured PutFile processor Conflict Resolution strategy as Ignore
The reason behind changing filename is SplitRecord processor is going to have same filename for all the splitted flowfiles.
Flow:
I tried your case and flow worked as expected, Use this template for your reference and upload to your NiFi instance, Make changes as per your requirements.

Jmeter dynamic URL property with variable not substituted

I have a simple Jmeter test where I have a property to set the URL. The PATH in the Jmeter test is set to the following.
${__P(GET_URL,)}
This works well for all URLs that I have been working with, except for the ones where I need to pass a variable in the URL component.
For example, it works for http://server:port/getemployeelist when I run the test with -JGET_URL=/getemployeelist
Then I created a CSV config element to populate the variable EMP_ID.
Then if I run the test with -JGET_URL=/getemployee/${EMP_ID}, the EMP_ID variable is not getting substituted. Jmeter test gives me an error as follows:
java.net.URISyntaxException: Illegal character in path at index xx: https://://getemployee/${EMP_ID}
Appreciate any help/pointers.
It will not work this way, JMeter doesn't know anything about ${EMP_ID} at the time it is being started, you need to append this ${EMP_ID} to HTTP Request sampler "Path" in the runtime
Start JMeter as:
jmeter -JGET_URL=/getemployee/
Use CSV Data Set Config to read the EMP_ID from the CSV File
In the HTTP Request sampler use construction like /${__P(GET_URL,)}/${EMP_ID} to combine JMeter Property specified via -J command line argument and JMeter Variable originating from the CSV file.
If anything goes wrong first of all check jmeter.log file - it normally contains enough troubleshooting information. If there is nothing suspicious - use Debug Sampler and View Results Tree listener combination to inspect requests and response details, variables and properties names and values, etc.
Had asked this question a while back. Thought of posting the solution which I eventually ended up implementing. In the solution, I created a template jmx with a substitution variable for the HttpSampler.path and then replace the path at runtime. Following are the key points from the scripting done.
This turned out to be a simpler solution that worked for all kinds of API call patterns.
Created a template jmx (jmeter_test_template) with the following line.
<stringProp name="HTTPSampler.path">#PATH#</stringProp>
This jmx has CSV config element to populate variable "EMP_ID". To create this file, just create a new test with any URL and then save it as a template and replace the URL with substitution variable #PATH#.
Created a wrapper script like run_any_api.sh with usage,
sh run_any_api.sh URL=http://server:port/myapp/employees/${EMP_ID}
In the wrapper script, this URL is replaced in place of the token.
sed "s/#PATH#/$URL" jmeter_test_template.jmx > jmeter_test_template.current_test.jmx
jmeter -t jmeter_test_template.current_test.jmx
Last but not the least, please remember to cleanup the temporary jmx,
rm jmeter_test_template.current_test.jmx

How to use Reject file in infobright with version 4.0.6 GA

In the release notes of version 4.0.6 GA, we can found that the first new feature is "Infobright Loader now supports a Reject file"
But I cannot find anything more about this, just like how to use it, and in which case we may need it.
Please help
To enable the reject file functionality, you must specify BH_REJECT_FILE_PATH and one of
the associated parameters (BH_ABORT_ON_COUNT or BH_ABORT_ON_THRESHOLD).
For example, if you want to load data from the file DATAFILE.csv to table T but you expects
that 10 rows in this file might be wrongly formatted, you would run the following
commands:
set #BH_REJECT_FILE_PATH = '/tmp/reject_file';
set #BH_ABORT_ON_COUNT = 10;
load data infile DATAFILE.csv into table T;
If less than 10 rows are rejected, a warning will be output, the load will succeed and all
problematic rows will be output to the file /tmp/reject_file. If the Infobright Loader finds a
tenth bad row, the load will terminate with an error and all bad rows found so far will be
output to the file /tmp/reject_file.