Jmeter-Maven-Plugin高级应用:Selecting Tests To Run
地址:https://github.com/jmeter-maven-plugin/jmeter-maven-plugin/wiki/Advanced-Configuration
Selecting Tests To Run
- Running All Tests
- Specifying <testFilesIncluded>
- Specifying <testFilesIncluded> Using Regex
- Specifying <testFilesExcluded>
- Specifying <testFilesExcluded> Using Regex
- Specifying The <testFilesDirectory>
Running All Tests
To run all tests held in the ${project.base.directory}/src/test/jmeter you just need to run the phase you have assigned to the execution phase.
In the example below the execution phase has been set to verify:
+---+
<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>
</plugin>
</plugins>
</build>
[...]
</project>
+---+
So to run all the tests type:
mvn verify
Specifying <testFilesIncluded>
You can explicitly specify which tests in the ${project.base.directory}/src/test/jmeter should be run by using the <jMeterTestFiles> tag:
+---+
<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>
<testFilesIncluded>
<jMeterTestFile>test1.jmx</jMeterTestFile>
<jMeterTestFile>test2.jmx</jMeterTestFile>
</testFilesIncluded>
</configuration>
</plugin>
</plugins>
</build>
[...]
</project>
+---+
This time when you type mvn verify only test1.jmx and test2.jmx will be run.
Specifying <testFilesIncluded> Using Regex
You can also use a regex to specify which tests to include, below is a simple example showing how to include all tests starting with the text foo:
+---+
<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>
<testFilesIncluded>
<jMeterTestFile>foo*.jmx</jMeterTestFile>
</testFilesIncluded>
</configuration>
</plugin>
</plugins>
</build>
[...]
</project>
+---+
Specifying <testFilesExcluded>
Rather than specifying which tests should be run, you could alternatively specify which tests in the ${project.base.directory}/src/test/jmeter you do not wish to run by using the <excludeJMeterTestFiles> tag:
+---+
<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>
<testFilesExcluded>
<excludeJMeterTestFile>test3.jmx</excludeJMeterTestFile>
<excludeJMeterTestFile>test4.jmx</excludeJMeterTestFile>
</testFilesExcluded>
</configuration>
</plugin>
</plugins>
</build>
[...]
</project>
+---+
This time when you type mvn verify all tests in the tests in the${project.base.directory}/src/test/jmeter apart from test3.jmx and test4.jmx will be run.
Specifying <testFilesExcluded> Using Regex
You can also use a regex to specify which tests to exclude, below is a simple example showing how to include all tests ending with the text bar:
+---+
<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>
<testFilesExcluded>
<excludeJMeterTestFile>*bar.jmx</excludeJMeterTestFile>
</testFilesExcluded>
</configuration>
</plugin>
</plugins>
</build>
[...]
</project>
+---+
Specifying The <testFilesDirectory>
You can specify the directory where the test 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>
<testFilesDirectory>/scratch/testfiles/</testFilesDirectory>
</configuration>
</plugin>
</plugins>
</build>
[...]
Jmeter-Maven-Plugin高级应用:Selecting Tests To Run的更多相关文章
- Maven实现Web应用集成測试自己主动化 -- 測试自己主动化(WebTest Maven Plugin)
近期在appfuse看到使用webtest-maven-plugin实现Web应用的集成測试,研究了下.感觉很不错.对于Web应用自己主动构建很有帮助,在性能測试之前能够保证Web应用的基本功能工作正 ...
- 学习Maven之Cobertura Maven Plugin
cobertura-maven-plugin是个什么鬼? cobertura-maven-plugin是一个校验单元测试用例覆盖率的工具,可以生成一个测试覆盖率报告,可以给单元测试用例编写提供参考. ...
- 基于Jmeter+maven+Jenkins构建性能自动化测试平台
一.目的: 为能够将相关系统性能测试做为常规化测试任务执行,且可自动无人值守定时执行并输出性能测试结果报告及统计数据,因此基于Jmeter+maven+Jenkins构建了一套性能自动化测试平台 ...
- Jmeter+maven+Jenkins构建云性能测试平台(mark 推荐)
转自:http://www.cnblogs.com/victorcai0922/archive/2012/06/20/2555502.html Jmeter+maven+Jenkins构建云性能测试平 ...
- tomcat:run和tomcat7:run的区别,以及Apache Tomcat Maven Plugin 相关
起因: 同事部署的maven项目,之前使用 jetty,现在切换到 tomcat,但是他使用的命令是 tomcat:run ,而不是 tomcat7:run,能启动,但出现问题了. 于是搜索了一番,想 ...
- Win10系统Jmeter+maven+Jenkins接口自动化环境搭建(一)
Jmeter+maven+Jenkins实现接口自动化,需要使用idea或eclipse配置maven项目,这里我使用的是idea.具体步骤如下: 1.安装jmeter+jdk jmeter安装之前需 ...
- Maven实现Web应用集成測试自己主动化 -- 部署自己主动化(WebTest Maven Plugin)
上篇:Maven实现Web应用集成測试自己主动化 -- 測试自己主动化(WebTest Maven Plugin) 之前介绍了怎样在maven中使用webtest插件实现web的集成測试,这里有个遗留 ...
- 解决Jetty Maven Plugin:Please initialize the log4j system properly(转)
解决Jetty Maven Plugin:Please initialize the log4j system properly.Jetty Maven Plugin环境: <plugin> ...
- Spring Boot Maven Plugin(二):run目标
简介 Spring Boot Maven Plugin插件提供spring boot在maven中的支持.允许你打包可运行的jar包或war包. 插件提供了几个maven目标和Spring Boot ...
随机推荐
- 关于ftp操作内容记录
ftp问题解决: http://www.linuxdiyf.com/viewarticle.php?id=272088 IPTABLES_MODULES="ip_nat_ftp ip_con ...
- 007. 自定义ListBox的item的宽高, 字体居中
/// <summary> /// 自定义ListBox的item的宽高, 字体居中 /// </summary> /// <param name="sende ...
- P1003 越野跑【tyvj】
/*=========================================================== P1003 越野跑 描述 Description 为了能在下一次跑步比赛中有 ...
- 【转】ASP.NET中服务器控件Table动态生成表格及其属性介绍
下文所有内容转自开源中国:http://www.oschina.net/question/565065_86453#tags_nav ================================= ...
- docker 镜像的保存以及导入
docker 镜像的保存 docker save -o davename.tar images docker 镜像的导入 docker import - importname < tar ...
- C#中的List<string>泛型类示例
在C#代码中使用一系列字符串(strings)并需要为其创建一个列表时,List<string>泛型类是一个用于存储一系列字 符串(strings)的极其优秀的解决办法.下面一起有一些Li ...
- python compile
compile(source, filename, mode[, flags[, dont_inherit]]) 参数source:字符串或者AST(Abstract Syntax Trees)对象. ...
- js正则及常用方法函数总结
正则表达式作为一种匹配处理字符串的利器在很多语言中都得到了广泛实现和应用,web开发本质上是处理字符串(服务端接受请求处理后拼接字符串作为响应,这在早期的CGI编程中最明显,然后客户端解析字符串进行渲 ...
- EditText使用详解-包含很多教程上看不到的功能演示
写道 标题有点大,说是详解,其实就是对EditText的一些常用功能的介绍,包括密码框,电话框,空白提示文字等等的讲解,尽量的介绍详细一点,也就是所谓的详解了..呵呵 广告一下我的应用“我团”,最新1 ...
- .NET(C#)生成条形码
using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Secu ...