Modifying Properties

Modifying Properties


Using Your Own Properties Files

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:

  • jmeter.properties
  • saveservice.properties
  • upgrade.properties
  • system.properties
  • user.properties
  • global.properties

Adding Additional Properties To <propertiesJMeter>

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 <propertiesJmeter>(The example below shows a property called log_level.jmeter being set).

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.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>2.0.3</version>
<executions>
<execution>
<id>jmeter-tests</id>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
</executions>
<configuration>
<propertiesJMeter>
<log_level.jmeter>DEBUG</log_level.jmeter>
</propertiesJMeter>
</configuration>
</plugin>
</plugins>
</build>
[...]
</project>
+---+

Adding Additional Properties To <propertiesSaveService>

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<propertiesSaveservice> (The example below shows a property called HTTPSampler2 being set).

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.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>2.0.3</version>
<executions>
<execution>
<id>jmeter-tests</id>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
</executions>
<configuration>
<propertiesSaveService>
<HTTPSampler2>org.apache.jmeter.protocol.http.sampler.HTTPSampler2</HTTPSampler2>
</propertiesSaveService>
</configuration>
</plugin>
</plugins>
</build>
[...]
</project>
+---+

Adding Additional Properties To <propertiesUpgrade>

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 <propertiesUpgrade>. (The example below shows a property called my.old.ClassName being set).

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.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>2.0.3</version>
<executions>
<execution>
<id>jmeter-tests</id>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
</executions>
<configuration>
<propertiesUpgrade>
<my.old.ClassName>my.new.ClassName</my.old.ClassName>
</propertiesUpgrade>
</configuration>
</plugin>
</plugins>
</build>
[...]
</project>
+---+

Adding Additional Properties To <propertiesUser>

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<propertiesUser> (The example below shows a property called threads and a propery calledtestIterations being set).

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.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>2.0.3</version>
<executions>
<execution>
<id>jmeter-tests</id>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
</executions>
<configuration>
<propertiesUser>
<threads>10</threads>
<testIterations>5</testIterations>
</propertiesUser>
</configuration>
</plugin>
</plugins>
</build>
[...]
</project>
+---+

Adding Additional Properties To <propertiesGlobal>

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<propertiesGlobal> (The example below shows a property called threads and a property calledtestIterations being set).

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.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>2.0.3</version>
<executions>
<execution>
<id>jmeter-tests</id>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
</executions>
<configuration>
<propertiesGlobal>
<threads>10</threads>
<testIterations>5</testIterations>
</propertiesGlobal>
</configuration>
</plugin>
</plugins>
</build>
[...]
</project>
+---+

Adding Additional Properties To <propertiesSystem>

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<propertiesSystem> (The example below shows a property called my.system.property being set).

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.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>2.0.3</version>
<executions>
<execution>
<id>jmeter-tests</id>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
</executions>
<configuration>
<propertiesSystem>
<my.system.property>my.system.property.value</my.system.property>
</propertiesSystem>
</configuration>
</plugin>
</plugins>
</build>
[...]
</project>
+---+

Setting <propertiesReplacedByCustomFiles>

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<propertiesReplacedByCustomFiles> to true (it is false by default). Please think very carefullybefore doing this, the reason we merge properties by default is to ensure that all properties are merged into the latest valid versions of the properties files supplied with JMeter. If you overwrite the properties files but are missing a property that is required by JMeter things will most likely break.

+---+
<project>
[...]
<build>
<plugins>
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>2.0.3</version>
<executions>
<execution>
<id>jmeter-tests</id>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
</executions>
<configuration>
<propertiesReplacedByCustomFiles>${basedir}true</propertiesReplacedByCustomFiles>
</configuration>
</plugin>
</plugins>
</build>
[...]
</project>
+---+

Specifying A <customPropertiesFile>

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.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>2.0.3</version>
<executions>
<execution>
<id>jmeter-tests</id>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
</executions>
<configuration>
<customPropertiesFiles>
<file>/user/home/myuser/myCustom.properties</file>
</customPropertiesFiles>
</configuration>
</plugin>
</plugins>
</build>
[...]
</project>
+---+

Specifying The <propertiesFilesDirectory>

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.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>2.0.3</version>
<executions>
<execution>
<id>jmeter-tests</id>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
</executions>
<configuration>
<propertiesFilesDirectory>/user/home/myuser/properties</propertiesFilesDirectory>
</configuration>
</plugin>
</plugins>
</build>
[...]
</project>
+---+

Jmeter-Maven-Plugin高级应用:Modifying Properties的更多相关文章

  1. Spring Boot的Maven插件Spring Boot Maven plugin详解

    Spring Boot的Maven插件(Spring Boot Maven plugin)能够以Maven的方式为应用提供Spring Boot的支持,即为Spring Boot应用提供了执行Mave ...

  2. 基于Jmeter+maven+Jenkins构建性能自动化测试平台

      一.目的: 为能够将相关系统性能测试做为常规化测试任务执行,且可自动无人值守定时执行并输出性能测试结果报告及统计数据,因此基于Jmeter+maven+Jenkins构建了一套性能自动化测试平台 ...

  3. Jmeter+maven+Jenkins构建云性能测试平台(mark 推荐)

    转自:http://www.cnblogs.com/victorcai0922/archive/2012/06/20/2555502.html Jmeter+maven+Jenkins构建云性能测试平 ...

  4. 学习Maven之Cobertura Maven Plugin

    cobertura-maven-plugin是个什么鬼? cobertura-maven-plugin是一个校验单元测试用例覆盖率的工具,可以生成一个测试覆盖率报告,可以给单元测试用例编写提供参考. ...

  5. Maven实现Web应用集成測试自己主动化 -- 部署自己主动化(WebTest Maven Plugin)

    上篇:Maven实现Web应用集成測试自己主动化 -- 測试自己主动化(WebTest Maven Plugin) 之前介绍了怎样在maven中使用webtest插件实现web的集成測试,这里有个遗留 ...

  6. 解决Jetty Maven Plugin:Please initialize the log4j system properly(转)

    解决Jetty Maven Plugin:Please initialize the log4j system properly.Jetty Maven Plugin环境: <plugin> ...

  7. Spring Boot Maven Plugin(一):repackage目标

    简介 Spring Boot Maven Plugin插件提供spring boot在maven中的支持.允许你打包可运行的jar包或war包. 插件提供了几个maven目标和Spring Boot ...

  8. Spring Boot Maven Plugin打包异常及三种解决方法:Unable to find main class

    [背景]spring-boot项目,打包成可执行jar,项目内有两个带有main方法的类并且都使用了@SpringBootApplication注解(或者另一种情形:你有两个main方法并且所在类都没 ...

  9. Maven实现Web应用集成測试自己主动化 -- 測试自己主动化(WebTest Maven Plugin)

    近期在appfuse看到使用webtest-maven-plugin实现Web应用的集成測试,研究了下.感觉很不错.对于Web应用自己主动构建很有帮助,在性能測试之前能够保证Web应用的基本功能工作正 ...

随机推荐

  1. python编程之socket编程基础

    python socket编程,首先需要import   socket模块 首先创建一个socket对象 expl = socket.socket(socket.AF_INET,socket.SOCK ...

  2. Problem F: 铺地砖

    Description 元旦过去了,新年大酬宾活动也已经告一段落了.陈盖历望着堆在仓库的瓷砖,很无聊的他把这些瓷砖裁成很多1X1 1X2 1X3的小瓷砖,然后他把这些小瓷砖排在地上画的一个1*n的长方 ...

  3. CF 277.5 C.Given Length and Sum of Digits.. 构造

    #include <cstdio> #include <cmath> #include <cstring> #include <ctime> #incl ...

  4. spring---transaction(6)---事务的配置

    1 写在前面 上一篇我们了解到spring的事务的体系.这里我们将结合上篇讲spring事务的配置 2 Spring的三种事务配置形式 2.1 使用TransactionProxyFactoryBea ...

  5. Go语言Web框架gwk介绍 (一)

    今天看到Golang排名到前30名了,看来关注的人越来越多了,接下来几天详细介绍Golang一个web开发框架GWK. 现在博客园支持markdown格式发布文章么?后台的编辑器不太好用嘛. GWK ...

  6. Syncthing -- 开源的云储存和同步服务工具

    Syncthing  -- an open-source file synchronization client/server application Syncthing是一个开源的云存储和同步服务工 ...

  7. C# 转换图形为PCX 格式

    2010-5-27 PCX RLE压缩图形的行对齐比.NET多了一位.已经修正了. 2009 -7-25 C# 转换图形为PCX 格式 增加了对1位色的PCX的读取 2009-6 -12 RLE数据压 ...

  8. 【微信小程序】在微信开发工具上七牛云的图片可以看到,但是在真机上看不到的原因解决

    在开发微信小程序过程中,在微信开发者工具上,七牛云的图片都可以展示出来,但是在真机上,七牛云的图片却展示不出来,也没有报404找不到或者不能加载图片的问题, 必须保证: 1.图片是用image加载的: ...

  9. Unity3.x游戏开发经典教程 书例 100%完毕~

    大家都公布自己的作品,作为一个新人,我也发点什么.刚刚做完了Unity3.x游戏开发经典教程书例不久,假如有同学想学这本书入门U3D,我的作品也能让新人參考一下...脚本都是C#写的.以下附上链接~ ...

  10. [翻译] DFXCoreTextView

    DFXCoreTextView https://github.com/davefoxy/DFXCoreTextView A CoreText wrapper for the formatting an ...