Saturday, February 20, 2016

Jmeter - Csv Information Develop Config Usage

| Saturday, February 20, 2016
CSV Data Set Config is ane of the configuration chemical component of Apache JMeter software charge testing tool. CSV Data Set Config allows you lot to read variable values from csv file in addition to and hence you lot tin terminate purpose those values inward samples of your software charge evidence invention equally per your requirement. Here nosotros volition see, How to add together CSV Data Set Config inward your software charge evidence invention in addition to how to read information from csv file. Let's acquire alongside example.

Add CSV Data Set Config In Software Load Test Plan
You tin terminate add together CSV Data Set Config nether thread group, controller or asking equally per your requirement. But delight banking venture annotation ane matter here, It volition last processed before whatever samplers inward the electrical flow reach regardless of its position. So when you lot run test, First it volition procedure CSV Data Set Config in addition to and hence it volition execute samplers.

Have you lot Read about Synchronizing Timer?

Let's add together CSV Data Set Config nether thread grouping of your software charge evidence plan. To produce so,
  • Right click on Thread Group,
  • Select Add -> Config Element -> CSV Data Set Config equally shown inward bellow image.


It volition add CSV Data Set Config nether Thread Group.

Parameters Of CSV Data Set Config
CSV Data Set Config has many unlike parameters equally shown inward bellow icon to configure it equally per your requirement. Let me explicate them.

  • Filename : In this field, You tin terminate develop CSV information file advert in addition to it's path. Example : E:\Test.csv
  • File Encoding : This champaign volition last used when encoding is used to read the file.
  • Variable Names : Variable names listing alongside comma-delimited to shop values which are read from csv file. Example : X,Y,Z
  • Delimiter : Delimiter to purpose to carve upwardly information during reading it from file. Use comma(,) for comma-delimited file in addition to \t for tab delimited file.
  • Allow quoted data? : If you lot wants to read double quoted(") information from file in addition to hence develop it to true. Example : "Y2".
  • Recycle on EOF? : Set it to truthful if you lot wants to read information from get-go of file when reaching on terminate of file. Default it volition last true.
  • Stop thread on EOF? : Set it truthful if you lot wants to halt thread on end of file if Recycle on EOF? = false.
  • Sharing mode : If conduct All threads in addition to hence it volition portion file betwixt all threads. If develop electrical flow thread grouping in addition to hence each file volition last opened ane time per each thread group. If develop electrical flow thread in addition to hence each file volition last opened separately for each thread.
Using CSV Data Set Config In Software Load Test
Scenario : I wants to read data(from iii columns comma-delimited) from csv file in addition to impress inward sentiment lawsuit inward tree using Debug.

I bring created rattling unproblematic charge evidence invention to explicate how to purpose CSV Data Set Config inward software charge evidence invention to read information from csv file.

I bring added CSV Data Set Config nether Thread Group equally shown inward bellow image.


Test.csv file has information similar bellow. You tin terminate download it from THIS PAGE.


You tin terminate run into that nosotros bring iii information columns inward csv file hence nosotros bring used iii variables(X,Y,Z) inward CSV Data Set Config.

Thread grouping configuration is equally bellow. Loop count is xv iterations.


I bring used Debug Sampler to run into all iii variable's values on each thread iteration.


Now if you lot volition run higher upwardly test, output of 1st debug sampler volition looks similar bellow.




In 1st debug sampler's result, You tin terminate run into that CSV file's firstly row information is printed. Same way, 2d row's information volition last printed inward lawsuit of 2d debug sampler's lawsuit in addition to hence on.

If you lot wants to purpose variable's information anywhere inward your software charge evidence invention in addition to hence you lot tin terminate purpose it this means -> position ${X} To purpose X variable's value

As you lot know, We bring solely v rows information inward csv file in addition to loop count inward thread grouping is 15. So sixth debug sampler volition impress 1st row's information ane time to a greater extent than equally nosotros bring set Recycle on EOF? = truthful in CSV Data Set Config. In this case, It volition start reading information from get-go of file ane time attain on terminate of file.


This way, You tin terminate use CSV Data Set Config inward your software charge evidence invention to read information from csv file.

Related Posts