地址:https://github.com/jmeter-maven-plugin/jmeter-maven-plugin/wiki/Advanced-Configuration

Selecting Tests To Run


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的更多相关文章

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

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

  2. 学习Maven之Cobertura Maven Plugin

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

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

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

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

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

  5. tomcat:run和tomcat7:run的区别,以及Apache Tomcat Maven Plugin 相关

    起因: 同事部署的maven项目,之前使用 jetty,现在切换到 tomcat,但是他使用的命令是 tomcat:run ,而不是 tomcat7:run,能启动,但出现问题了. 于是搜索了一番,想 ...

  6. Win10系统Jmeter+maven+Jenkins接口自动化环境搭建(一)

    Jmeter+maven+Jenkins实现接口自动化,需要使用idea或eclipse配置maven项目,这里我使用的是idea.具体步骤如下: 1.安装jmeter+jdk jmeter安装之前需 ...

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

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

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

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

  9. Spring Boot Maven Plugin(二):run目标

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

随机推荐

  1. 转(JSONP处理跨域事件)

     前言: 由于Sencha Touch 2这种开发模式的特性,基本决定了它原生的数据交互行为几乎只能通过AJAX来实现. 当然了,通过调用强大的PhoneGap插件然后打包,你可以实现100%的Soc ...

  2. Web Pages razor 学习

    1. Web Pages razor Web Pages 是三种 ASP.NET 编程模型中的一种,用于创建 ASP.NET 网站和 web 应用程序. 其他两种编程模型是 Web Forms 和 M ...

  3. 【性能诊断】七、并发场景的性能分析(windbg案例,线程阻塞)

    简单整理一个测试Demo,抓取dump并验证,步骤如下: Symbol File Path:SRV*C:\Symbols*http://msdl.microsoft.com/download/symb ...

  4. Http状态码301和302概念简单区别

    1.什么是301重定向? 301重定向/跳转一般,表示本网页永久性转移到另一个地址. 301是永久性转移(Permanently Moved),SEO常用的招式,会把旧页面的PR等信息转移到新页面: ...

  5. [原]Fedora Linux环境下的应用工具总结

    一.办公类软件 1.Office办公:WPS 二.网络通信类软件 1.浏览器:Chrome 2.远程桌面:rdesktop(适用于Windows系列) 三.操作系统设置与优化 1.3D桌面管理:Com ...

  6. LINQ学习入门教程(一)

    LINQ 查询简介       Linq 是一跨各种数据源和数据格式的数据模型:它在查询是,始终是把它作为一种对象来操作,可以使用基本相同的编码模型查询和数据的转换XML,SQL,ADO数据等: Li ...

  7. 如何制作带MFC界面的MFC DLL

    最近在做基于组件化MFC界面的开发,需要把界面封装到动态库中. 一:工程创建步骤 1.创建MFC DLL工程,选择 “在共享 DLL 中使用 MFC”. 2.运行时库选择:c/c++-->代码生 ...

  8. 【Flex学习】Flex4学习网站

    http://blog.minidx.com/category/flex  来自为知笔记(Wiz)

  9. Session和Cookie深度剖析

    Session和Cookie的区别 具体来说cookie机制采用的是在客户端保持状态的方案,而session机制采用的是在服务器端保持状态的方案.同时我们也看到,由于采用服务器端保持状态的方案在客户端 ...

  10. 批量修改Sqlserver中数据库对象的所属架构

    执行以下SQL,将执行结果拷贝出来,批量执行既可. SELECT 'ALTER SCHEMA dbo TRANSFER ' + s.Name + '.' + p.Name FROM sys.Proce ...