1

Besides using the CSV config file and beanshell programming, is there any way to define the testdata specific to the environments?

Each environment varies different testdata(values) using same jmx script.

For example :Firstname,LastName,ProjectName so on..

Ori Marko
  • 56,308
  • 23
  • 131
  • 233
rpagadala
  • 796
  • 2
  • 15
  • 31

2 Answers2

1

You can have different properties in different environment.

You can have different or additional properties file

-p, --propfile the jmeter property file to use

-q, --addprop additional JMeter property file(s)

or override each property per environment using command line

-J[prop_name]=[value] defines a local JMeter property.

Ori Marko
  • 56,308
  • 23
  • 131
  • 233
  • Could you please elaborate by using above columns FirstName,LastName,Project.I am not sure how define those in property file as each clouds will have thousands of data values.Let’s say FirstName as values like Tom,Daniel,Peter so on.. – rpagadala Nov 07 '17 at 05:50
  • you can have different CSV file per environment and have the CSV file be the different property value, for production e.g. -JcsvFile=prodData.csv, for QA -JcsvFile=qaData.csv – Ori Marko Nov 07 '17 at 05:53
  • The entire test has 9 scenarios and each scenario uses different csv file.Lets say i can define property as -JcsvFile=PerfCreateNewEmployee.csv for One scenario,in this way how do I define PerfScenario2.csv ...PerfScenario9 for the same test. – rpagadala Nov 07 '17 at 06:02
  • For 9 CSVs you need 9 sets you can use -JcsvFile=PerfCreateNewEmployee, and then file names will be: ${csvFile}1.csv, ..${csvFile}9.csv – Ori Marko Nov 07 '17 at 06:26
  • So it will be -JcsvFile=PerfCreateNewEmployee.csv,PerfNewProjectSetup.csv,PerfPensionReport.csv so..on.Am I correct? – rpagadala Nov 07 '17 at 06:32
  • Won't it be easier with the scenario numbers from your last comment? – Ori Marko Nov 07 '17 at 06:50
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/158450/discussion-between-rpagadala-and-user7294900). – rpagadala Nov 07 '17 at 20:13
1

The fastest and the easiest way is using JMeter Properties like:

  1. In .jmx script define Firstname using __P() function like

    ${__P(Firstname)}
    
  2. When you start JMeter pass this Firstname property value via -J command-line argument like:

    jmeter -JFirstname=John
    

See Configuring JMeter User Manual chapter for more details.

Dmitri T
  • 159,985
  • 5
  • 83
  • 133