在pom.xml文件中可以指定运行哪些jmx脚本。

运行所有的测试脚本

Jmeter默认运行${project.base.directory}/src/test/jmeter文件夹中的所有脚本,下面是示例。

    <project>
[...]
<build>
<plugins>
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>1.9.0</version>
<executions>
<execution>
<id>jmeter-tests</id>
<phase>verify</phase>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
[...]
</project>

运行mvn verify即可。

使用<testFilesIncluded>指定运行的脚本文件

我们可以通过<testFilesIncluded>这个标签来手动指定jmx文件。样例如下:

    <plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>1.9.0</version>
<executions>
<execution>
<id>jmeter-tests</id>
<phase>verify</phase>
<goals>
<goal>jmeter</goal>
</goals>
<configuration>
<testFilesIncluded>
<jMeterTestFile>test1.jmx</jMeterTestFile>
<jMeterTestFile>test2.jmx</jMeterTestFile>
</testFilesIncluded>
</configuration>
</execution>
</executions>
</plugin>

当我们执行mvn verify时,只有${project.base.directory}/src/test/jmeter文件夹中的test1.jmx、test2.jmx会执行。

在<testFilesIncluded>中使用正则表达式

<testFilesIncluded>标签支持正则表达式,下面的示例,指定以foo开头的所有jmx文件。

            <plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>1.9.0</version>
<executions>
<execution>
<id>jmeter-tests</id>
<phase>verify</phase>
<goals>
<goal>jmeter</goal>
</goals>
<configuration>
<testFilesIncluded>
<jMeterTestFile>foo*.jmx</jMeterTestFile>
</testFilesIncluded>
</configuration>
</execution>
</executions>
</plugin>

使用<testFilesExcluded>标签反向指定jmx文件

我们还可以使用排除法,来指定不要运行${project.base.directory}/src/test/jmeter文件夹中的文件。样例:

            <plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>1.9.0</version>
<executions>
<execution>
<id>jmeter-tests</id>
<phase>verify</phase>
<goals>
<goal>jmeter</goal>
</goals>
<configuration>
<testFilesExcluded>
<excludeJMeterTestFile>test3.jmx</excludeJMeterTestFile>
<excludeJMeterTestFile>test4.jmx</excludeJMeterTestFile>
</testFilesExcluded>
</configuration>
</execution>
</executions>
</plugin>

当我们运行mvn verify时,${project.base.directory}/src/test/jmeter文件夹中除了test3.jmx和test4.jmx,其他的jmx文件都会执行。

<testFilesExcluded>标签使用正则表达式

反向指定jmx文件时,也可以使用正则表达式,样例:

            <plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>1.9.0</version>
<executions>
<execution>
<id>jmeter-tests</id>
<phase>verify</phase>
<goals>
<goal>jmeter</goal>
</goals>
<configuration>
<testFilesExcluded>
<excludeJMeterTestFile>*bar.jmx</excludeJMeterTestFile>
</testFilesExcluded>
</configuration>
</execution>
</executions>
</plugin>

运行时,以bar结束的jmx文件都会排除在外。

<testFilesDirectory>标签指定jmx文件夹

我们还可以自定义jmx文件的位置(默认是${project.base.directory}/src/test/jmeter)。

            <plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>1.9.0</version>
<executions>
<execution>
<id>jmeter-tests</id>
<phase>verify</phase>
<goals>
<goal>jmeter</goal>
</goals>
<configuration>
<testFilesDirectory>/scratch/testfiles/</testFilesDirectory>
</configuration>
</execution>
</executions>
</plugin>

Jmeter-maven-plugin高级配置之选择测试脚本(转)的更多相关文章

  1. 【maven】之配置开发,测试,正式环境pom.xml文件

    在进行web程序开发,如果项目组没有使用自动化发布工具(jenkins + maven + svn + tomcat ),我们一般会使用maven的热部署来完成发布,在部署的过程中我们开发,测试,生产 ...

  2. 7.Jmeter 快速入门教程--录制复杂web测试脚本

    Jmeter的功能简单,不需要有脚本语言的编写经验,纯图形界面添加测试场景, 用起来上手很快.但是如果手动添加每一个web(http/https)请求,费时又费力.而且有可能最后手动编写的和实际发的请 ...

  3. Appium环境的安装与配置,Python测试脚本测试

    Appium自动化测试系列1 - Appium环境的安装与配置 发表于4个月前(2015-01-27 14:34)   阅读(803) | 评论(0) 0人收藏此文章, 我要收藏 赞0 寻找 会’偷懒 ...

  4. JMeter - 如何创建可重用和模块化测试脚本

    概述: 我的应用程序几乎没有业务关键流程,我们可以从中提出不同的业务工作流程.当我试图在JMeter中提出性能测试脚本时,我需要找到一些方法来创建可重用/模块化的测试脚本.这样我就可以创建不同的工作流 ...

  5. 《JAVASCRIPT高级程序设计》选择框脚本和富文本编辑

    一.选择框脚本 选择框也是表单的一个字段,是通过<select>和<option>元素来创建的,需要使用javascript来控制.选择框拥有以下的属性和方法: 以下介绍一些选 ...

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

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

  7. 构建基于表单配置的 Jenkins 测试项目(接口、UI、APP、Jmeter)

    1. 第一个 hello world 项目 2. 构建自动触发的项目(接口测试) 1)新建测试项目(执行测试脚本) 2)新建 Maven 打包项目 3)手动执行构建 4)修改 Web 工程代码并 pu ...

  8. maven构建web项目,用jetty测试的配置pom.xml

    maven构建web项目,用jetty测试的配置pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmln ...

  9. eclipse maven plugin 插件 安装 和 配置

      离线插件 点击下载离线安装包:eclipse-maven-plugin.zip ( for eclipse helios or higher ) .解压缩到任意目录(如这里的plugins目录): ...

随机推荐

  1. [转]php rsa加密解密实例

    转自:http://blog.csdn.net/clh604/article/details/20224735 php服务端与客户端交互.提供开放api时,通常需要对敏感的部分api数据传输进行数据加 ...

  2. 常用sql备份

    统计数据库中表格数据行数所占空间和索引情况 set nocount on exec sp_MSForEachTable @precommand=N' create table ##( id int i ...

  3. 我的Visual Studio 2013常用快捷键

    声明及广告 所有功能针对C#开发配置而写,部分功能可能由插件提供,我会尽可能标注出相应的插件名称.为行文方便,所有快捷键以大写形式表示.太常用的快捷键,如Ctrl + C, Ctrl + Z, Ctr ...

  4. Android Animatioin总结

    一.动画分类 1.  View Animation (Tween动画)  执行一系列简单的转换.      针对 视图对象内容进行移动,放大,缩小以及产生透明度的变化等四种动画操作.仅针对视图对象内容 ...

  5. go语言之进阶篇接口的继承

    1.接口的继承 示例: package main import "fmt" type Humaner interface { //子集 sayhi() } type Persone ...

  6. CListCtrl 之右键菜单

    在使用CListCtrl时要为它添加一个右键菜单,步骤如下: 1. 响应CListCtrl的NM_RCLICK消息. 2. 添加一个菜单资源,在菜单资源中插入要添加到菜单内容.   一般存在两种方法: ...

  7. JQuery实现密码有短暂的显示过程和实现 input hint效果

    目录: 一.实现目的 二.问题思考 三.解决办法 1.输入用户名 2.输入密码短暂显示 一.实现目的 这几天做项目的时候,客户要求在文本框输入密码的时候,要求密码有短暂的显示过程,如下图: 二.问题思 ...

  8. tensorflow_python中文手册

    https://www.tensorflow.org/api_docs/python/tf/nn/static_bidirectional_rnn https://www.w3cschool.cn/t ...

  9. Linux中挂载新的磁盘到指定目录或分区

    新增磁盘的设备文件名为 /dev/vdb 大小为100GB. #fdisk -l  查看新增的的磁盘 1.对新增磁盘进行分区 #fdisk /dev/vdb 按提示操作 p打印  n新增 d 删除 w ...

  10. 【矩阵乘】【DP】【codevs 1305】Freda的道路

    1305 Freda的道路 时间限制: 1 s 空间限制: 128000 KB 题目等级: 大师 Master 题目描写叙述 Description Freda要到Rainbow的城堡去玩了. 我们能 ...