Home > Software design >  Shell script to divide csv files automatically using thread group count
Shell script to divide csv files automatically using thread group count

Time:10-26

Currently I am manually dividing the csv files for distributed testing of Jmeter from 3 machines. But I need a shell script which will automatically divide the csv files based on thread group count

CodePudding user response:

If you want to give unique values for each thread, you can simply do this by changing some values on CSV Data Set Config:

  1. Recycle on EOF : False
  2. Stop Thread on EOF : True
  3. Sharing mode: All Threads

After these values, each thread on your jmx will get unique values from your CSV file.

CodePudding user response:

If you need the shell script - go ahead and write it. It's not a code writing service, you're supposed to try to do something yourself and reach out to the community if you face a problem.

Normally it's not necessary to split the CSV file for the Thread Groups count, you just need to choose the appropriate Sharing Mode of the CSV Data Set Config

As an exception here is an example shell script which splits the CSV file by the number of thread groups in the .jmx script:

#!/usr/bin/env bash
threadGroups=`grep -c "\"ThreadGroup\"" test.jmx`
split --suffix-length="${threadGroups}" --additional-suffix=.csv -d --number="l/${threadGroups}" "test.csv" "."/ 

Replace test.jmx and test.csv with the names/locations of your .jmx and .csv files

it will generate .CSV files in form of 000.csv, 001.csv, etc.

More information: Split Command in Linux with Examples

  • Related