Set JMeter Properties Using Maven Plugin

I am using the Maven plugin for JMeter (http://jmeter.lazerycode.com/).

In my JMeter test plan, I defined various properties, for example. hostName, threadCount, etc.

If I used the standard JMeter program from the command line, I would specify the following properties:

jmeter -n -t mytest.jmx -JhostName=www.example.com -JthreadCount=5 

Since the Maven JMeter plugin is executed with the following command:

 mvn verify 

How to pass property values? Command:

 mvn verify -JhostName=www.example.com -JthreadCount=5 

It doesn't seem to work. I have to miss something obvious

+4
source share
3 answers

You can set the properties like this:

 <plugin> <groupId>com.lazerycode.jmeter</groupId> <artifactId>jmeter-maven-plugin</artifactId> <version>1.4.1</version> <executions> <execution> <id>jmeter-tests</id> <phase>verify</phase> <goals> <goal>jmeter</goal> </goals> </execution> </executions> <configuration> <propertiesUser> <hostName>www.example.com</hostName> </propertiesUser> </configuration> </plugin> 

Also check out this jmeter-maven-plugin-example

+5
source

Outside of your <build> block. You can put:

  <properties> <my.host>localhost</my.host> </properties> 

and then update your configuration block to say:

 <propertiesUser> <hostName>${my.host}</hostName> </propertiesUser> 

Finally, when you run maven, you can override with:

 mvn verify "-Dmy.host=www.testsite.com" 
+5
source
  <properties> <my.host>hostname</my.host> 

 <propertiesUser> <hostName>${my.host}</hostName> 

Finally, when you run maven, you can override with:

mvn check "-Dmy.host = www.testsite.com" if it is not?

0
source

Source: https://habr.com/ru/post/1439379/


All Articles