The easiest way to configure JMeter with this plugin is to supply your own properties files. When it starts up the plugin will scan the ${project.base.directory}/src/test/jmeter directory for the following files:
It is possible to set properties that configure the main JMeter library. To set those properties you will need to specify each property in your pom.xml in the config element
Each property specified is merged into the JMeter properties file jmeter.properties, it will overwrite any identical properties within the file.
+---+
<project>
[...]
<build>
<plugins>
<plugin>
<groupId>com.lazerycode.jmetergroupId>
<artifactId>jmeter-maven-pluginartifactId>
<version>2.0.3version>
<executions>
<execution>
<id>jmeter-testsid>
<goals>
<goal>jmetergoal>
goals>
execution>
executions>
<configuration>
<propertiesJMeter>
<log_level.jmeter>DEBUGlog_level.jmeter>
propertiesJMeter>
configuration>
plugin>
plugins>
build>
[...]
project>
+---+
It is possible to set properties that configure the Saveservice of the main JMeter library. To set those properties you will need to specify each property in your pom.xml in the config element
Each property specified is merged into the JMeter properties file saveservice.properties, it will overwrite any identical properties within the file.
+---+
<project>
[...]
<build>
<plugins>
<plugin>
<groupId>com.lazerycode.jmetergroupId>
<artifactId>jmeter-maven-pluginartifactId>
<version>2.0.3version>
<executions>
<execution>
<id>jmeter-testsid>
<goals>
<goal>jmetergoal>
goals>
execution>
executions>
<configuration>
<propertiesSaveService>
<HTTPSampler2>org.apache.jmeter.protocol.http.sampler.HTTPSampler2HTTPSampler2>
propertiesSaveService>
configuration>
plugin>
plugins>
build>
[...]
project>
+---+
It is possible to set properties that are used in the oldValue to newValue upgrade mapping of the main JMeter library. To set those properties you will need to specify each property in yourpom.xml in the config element
Each property specified is merged into the JMeter properties file upgrade.properties, it will overwrite any identical properties within the file.
+---+
<project>
[...]
<build>
<plugins>
<plugin>
<groupId>com.lazerycode.jmetergroupId>
<artifactId>jmeter-maven-pluginartifactId>
<version>2.0.3version>
<executions>
<execution>
<id>jmeter-testsid>
<goals>
<goal>jmetergoal>
goals>
execution>
executions>
<configuration>
<propertiesUpgrade>
<my.old.ClassName>my.new.ClassNamemy.old.ClassName>
propertiesUpgrade>
configuration>
plugin>
plugins>
build>
[...]
project>
+---+
JMeter user properties are properties supplied to JMeter that can be used in JMeter tests. To set user properties you will need to specify each property in your pom.xml in the config element
Each property specified is merged into the JMeter properties file user.properties, it will overwrite any identical properties within the file.
+---+
<project>
[...]
<build>
<plugins>
<plugin>
<groupId>com.lazerycode.jmetergroupId>
<artifactId>jmeter-maven-pluginartifactId>
<version>2.0.3version>
<executions>
<execution>
<id>jmeter-testsid>
<goals>
<goal>jmetergoal>
goals>
execution>
executions>
<configuration>
<propertiesUser>
<threads>10threads>
<testIterations>5testIterations>
propertiesUser>
configuration>
plugin>
plugins>
build>
[...]
project>
+---+
Global properties are properties that are sent to the remote machines. To set those properties you will need to specify each property in your pom.xml in the config element
Each property specified is merged into the JMeter properties file global.properties, it will overwrite any identical properties within the file.
+---+
<project>
[...]
<build>
<plugins>
<plugin>
<groupId>com.lazerycode.jmetergroupId>
<artifactId>jmeter-maven-pluginartifactId>
<version>2.0.3version>
<executions>
<execution>
<id>jmeter-testsid>
<goals>
<goal>jmetergoal>
goals>
execution>
executions>
<configuration>
<propertiesGlobal>
<threads>10threads>
<testIterations>5testIterations>
propertiesGlobal>
configuration>
plugin>
plugins>
build>
[...]
project>
+---+
JMeter can set system properties, these are global environment properties accessible by all applications running in the same JVM (They are not accessible outside the JVM). To set system properties you will need to specify each property in your pom.xml in the config element
Each property specified is merged into the JMeter properties file system.properties, it will overwrite any identical properties within the file.
+---+
<project>
[...]
<build>
<plugins>
<plugin>
<groupId>com.lazerycode.jmetergroupId>
<artifactId>jmeter-maven-pluginartifactId>
<version>2.0.3version>
<executions>
<execution>
<id>jmeter-testsid>
<goals>
<goal>jmetergoal>
goals>
execution>
executions>
<configuration>
<propertiesSystem>
<my.system.property>my.system.property.valuemy.system.property>
propertiesSystem>
configuration>
plugin>
plugins>
build>
[...]
project>
+---+
By default all properties specified in the settings above will be merged with any existing properties. If you want them to be replaced instead you can do this by setting
+---+
<project>
[...]
<build>
<plugins>
<plugin>
<groupId>com.lazerycode.jmetergroupId>
<artifactId>jmeter-maven-pluginartifactId>
<version>2.0.3version>
<executions>
<execution>
<id>jmeter-testsid>
<goals>
<goal>jmetergoal>
goals>
execution>
executions>
<configuration>
<propertiesReplacedByCustomFiles>${basedir}truepropertiesReplacedByCustomFiles>
configuration>
plugin>
plugins>
build>
[...]
project>
+---+
This will allow you to set an absolute path to JMeter custom (test dependent) properties file. This is the equivalent of setting " --addprop my.properties" on the command line.
+---+
<project>
[...]
<build>
<plugins>
<plugin>
<groupId>com.lazerycode.jmetergroupId>
<artifactId>jmeter-maven-pluginartifactId>
<version>2.0.3version>
<executions>
<execution>
<id>jmeter-testsid>
<goals>
<goal>jmetergoal>
goals>
execution>
executions>
<configuration>
<customPropertiesFiles>
<file>/user/home/myuser/myCustom.propertiesfile>
customPropertiesFiles>
configuration>
plugin>
plugins>
build>
[...]
project>
+---+
You can specify the directory where the .properties files are located in your file system (by default the plugin will assume they are in ${project.base.directory}/src/test/jmeter)
+---+
<project>
[...]
<build>
<plugins>
<plugin>
<groupId>com.lazerycode.jmetergroupId>
<artifactId>jmeter-maven-pluginartifactId>
<version>2.0.3version>
<executions>
<execution>
<id>jmeter-testsid>
<goals>
<goal>jmetergoal>
goals>
execution>
executions>
<configuration>
<propertiesFilesDirectory>/user/home/myuser/propertiespropertiesFilesDirectory>
configuration>
plugin>
plugins>
build>
[...]
project>
+---+
Jmeter-Maven-Plugin高级应用:Modifying Properties