Shyam Reddy
Shyam Reddy

Reputation: 51

How to pass external arguments to jmeter script

I am trying to write a JMeter script which can be used on multiple machines. Example :

stringProp name="Argument.value"

7|0|44|https://${server}:8693/cea/ABC_WebClient/|${randomString}|com.test.server.gui.question

/stringProp In above line, i need to pass server and randomString as an external argument. How do I pass those values to script? I cannot define them in CSV file or something to pass an argument.

Upvotes: 0

Views: 2773

Answers (1)

Dmitri T
Dmitri T

Reputation: 168147

  1. You can pass the values to JMeter script via -J command-line argument like:

    jmeter -Jserver=localhost -JrandomString=foobarbaz -n -t test.jmx -l result.jtl
    
  2. In your .jmx script you can access the values via __P() function like:

    7|0|44|https://${__P(server,)}:8693/cea/ABC_WebClient/|${__P(randomString,)}|com.test.server.gui.question
    

More information:

Upvotes: 1

Related Questions