地址: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. for循环小题

    已知数列1,1,2,3,5,8,…….,N.输出前N项的和: 出1到100之间所有偶数之和 国际象棋问题 已知数列1,1,2,3,5,8,…….,N.输出前N项的和: int a = 1, b = 1 ...

  2. ABBYY PDF Transformer+从文件选项中创建PDF文档的教程

    可使用OCR文字识别软件ABBYY PDF Transformer+从Microsoft Word.Microsoft Excel.Microsoft PowerPoint.HTML.RTF.Micr ...

  3. ASP.NET MVC中的拦截器

    在ASP.NET MVC中,有三种拦截器:Action拦截器.Result拦截器和Exception拦截器, 所谓的拦截器也没有什么的,只是写一个类,继承另一个类和一个接口,顺便实现接口里面的方法而以 ...

  4. 010. 使用.net框架提供的属性

    C#允许在类和类成员上声明特性(类), 可在运行时解释类和类的成员. 这个特性也称为属性, 使用Attribute.下面演示如何使用.net框架提供的属性. using System; using S ...

  5. linux服务之ntp与chrony

    centos7.2变成了chrony RHEL从7.0开始改用chrony同步时间,原ntp同步方式也可以使用,但要安装ntp服务. [root@1st-kvm plymouth]# rpm -qa| ...

  6. caller 属性和callee属性

    1.caller 属性 返回一个对函数的引用,即调用了当前函数的函数体. functionName.caller :functionName 对象是所执行函数的名称. 说明: 对于函数来说,calle ...

  7. EDM营销算法:python自动批量发邮件

    EDM营销:全称Email Direct Marketing,即电子邮件营销.企业可以通过使用EDM软件向目标客户发送EDM邮件,建立同目标顾客的沟通渠道,向其直接传达相关信息,用来促进销售.EDM软 ...

  8. JaxWsDynamicClientFactory弃用了,改成org.codehaus.xfire.client;

    搞了好几天jar包冲突,最后修改接口调用方式 java.lang.IllegalStateException: Unable to create JAXBContext for generated p ...

  9. Spark(四): Spark-sql 读hbase

    SparkSQL是指整合了Hive的spark-sql cli, 本质上就是通过Hive访问HBase表,具体就是通过hive-hbase-handler, 具体配置参见:Hive(五):hive与h ...

  10. [转]Hibernate Session各种状态转换方法分析

    摘自http://spiritfrog.iteye.com/blog/221177 我的印象里, Hibernate session中常用的保存操作只有:save, update, saveOrUpd ...