user5155835
user5155835

Reputation: 4742

Automate creation of Test Plan

We're using JMeter to load test our application. Currently, whenever there is a change in the request body and headers, I need to open the JMeter UI, save the test plan, then execute this plan using jmeter command.

Is there any way the test plan modification can happen without the requirement of opening the JMeter UI and modifying it? So that I can directly run the jmeter command with the changes without having to open the UI.

Or is there any other application which facilitates this?

Upvotes: 1

Views: 110

Answers (1)

Dmitri T
Dmitri T

Reputation: 168122

  1. You can configure JMeter to read the request body from the file using __FileToString() function like:

    enter image description here

  2. You can use __P() function for each value you want to parameterize like:

    enter image description here

    Once done you will be able to pass the properties via -J command-line argument as:

     jmeter -Jheader.name.1=Content-Type -Jheader.value.1=applicatino/json -Jheader.name.2=Host -Jheader.name.2=example.com etc.
    
  3. There is __CSVRead() function which can fetch values from the comma-separated-value files

  4. You can pass an arbitrary .properties file (name-value-pair file) to JMeter via -q command-line argument and specify your changed values there, the values can be read using the aforementioned __P() function

Check out Apache JMeter Functions - An Introduction article to learn more about JMeter Functions concept.

Upvotes: 2

Related Questions