- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试弄清楚如何有条件地执行我的 JMeter 性能测试计划。我想让我的 Jenkins CI 作业执行它,但是当开发人员运行 mvn clean install
我不希望下面的插件运行。关于如何修改我的 pom.xml 以有条件地运行以下插件的任何想法?
Maven POM.xml JMeter 插件:
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>1.8.1</version>
<executions>
<execution>
<id>jmeter-tests</id>
<phase>verify</phase>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
</executions>
<configuration>
<testFilesDirectory>${project.basedir}/src/test/jmeter</testFilesDirectory>
<ignoreResultFailures>true</ignoreResultFailures>
<testResultsTimestamp>false</testResultsTimestamp>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>transform</goal>
</goals>
</execution>
</executions>
<configuration>
<transformationSets>
<transformationSet>
<dir>${project.build.directory}/jmeter/results</dir>
<stylesheet>${project.basedir}/src/test/resources/jmeter-results-detail-report_21.xsl</stylesheet>
<outputDir>${project.build.directory}/jmeter/results</outputDir>
<fileMappers>
<fileMapper implementation="org.codehaus.plexus.components.io.filemappers.RegExpFileMapper">
<pattern>(.*?)\s(.*?)</pattern>
<replacement>$1$2</replacement>
<replaceAll>true</replaceAll>
</fileMapper>
<fileMapper implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
<targetExtension>.html</targetExtension>
</fileMapper>
</fileMappers>
</transformationSet>
</transformationSets>
</configuration>
</plugin>
<plugin>
<groupId>ch.fortysix</groupId>
<artifactId>maven-postman-plugin</artifactId>
<version>0.1.2</version>
<executions>
<execution>
<id>send a mail</id>
<phase>install</phase>
<goals>
<goal>send-mail</goal>
</goals>
<inherited>false</inherited>
<configuration>
<from>admin@test.com</from>
<subject>Load Test Results</subject>
<failonerror>true</failonerror>
<mailhost>relay.apple.com</mailhost>
<htmlMessageFile>${project.build.directory}/jmeter/results/LoadTestPlan.html</htmlMessageFile>
<receivers>
<receiver>email@me.com</receiver>
</receivers>
<fileSets>
<fileSet>
<directory>${project.build.directory}/jmeter/results</directory>
<includes>
<include>LoadTestPlan.html</include>
</includes>
</fileSet>
</fileSets>
</configuration>
</execution>
</executions>
</plugin>
最佳答案
实现此目的的最佳方法是使用 profiles
.您定义一个包含您的插件配置的配置文件。默认情况下,此配置文件将被关闭(因此当开发人员执行 mvn clean install
时,它不会被激活),您只能在 Jenkins 作业期间激活它。
因此,例如在您的 pom 中,您将具有以下内容:
<project>
...
<profiles>
<profile>
<id>ci-environment</id>
<activation>
<activeByDefault>false</activeByDefault>
<property>
<name>build.environment</name>
<value>jenkins</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<!-- rest of your jmeter configuration goes here -->
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<!-- rest of your xml-maven configuration goes here -->
</plugin>
<plugin>
<groupId>ch.fortysix</groupId>
<artifactId>maven-postman-plugin</artifactId>
<!-- rest of your postman configuration goes here -->
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
因此默认情况下此配置文件未激活,插件不会执行。在 Jenkins 上,您可以将构建配置为按如下方式执行:
mvn clean install -Dbuild.environment=jenkins
由于配置文件有一个id
,您还可以将 Jenkins 配置为按名称专门使用配置文件,如下所示:
mvn clean install -Pci-environment
有关激活配置文件的可能方法的详细信息,请参阅以下 sonatype 资源: http://books.sonatype.com/mvnref-book/reference/profiles-sect-activation.html
关于java - 有条件地执行 JMeter Maven 插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20488401/
我正在尝试使用 jmeter java api 创建一个 jmeter jmx 文件。这就是我所做的, gui.jmx 使用 jmeter gui 应用程序创建一个引用 jmx 文件,我可以与之进行比
我在我的脚本中使用时间戳作为值,以使其在每次迭代中保持唯一和可区分。我正在使用 ${__time(/1)} 函数并将其存储在事务 Controller 内的用户定义变量中,然后在其他事务和 json
我的 CSV 文件中有 50 条记录(行),我有 10 个相互依赖的线程组。 示例(我正在调用线程组 TH): TH1 |_some request |_fetching output value
我有一个带有 N 个采样器的 JMeter 脚本。我打算在两个采样器之间添加一个 1000 毫秒的恒定计时器。但是我注意到它在每个采样器之前延迟了 1000 毫秒。我正在使用 JMeter 2.13
我已经根据 guru99.com 中的教程安装了 jmeter,现在完全按照 https://www.guru99.com/jmeter-performance-testing.html 中的步骤进行
我正在 Web 应用程序上使用 Jmeter 2.10 运行负载测试。 我有一个带有查看结果树监听器的 HTTP 采样器,我在公司代理后面运行。 当我使用单个线程运行线程组时, org.apache.
任何人都可以请给我一个关于如何在 JMeter 中使用正则表达式的简单示例。 最佳答案 首先阅读手册:http://jmeter.apache.org/usermanual/component_ref
目前,我编写的所有 JMeter 脚本在我与一个用户一起运行时从未出现过任何错误。但是,当我添加更多(即 5)时,一两个最终会给我 401 Authorization Required 消息。我有两个
我对 5 个用户运行了一个总共 20 秒的测试计划,但我无法理解的是实际的加速期是什么。这是否意味着每个用户将获得 4 秒或 20 秒将总共用于 5 个用户? 如果情况 1 为真(每个用户 4 秒),
我需要对我开发的服务进行负载测试,但我需要发布到 Web 服务的数据有一些差异。 我已经使用 Http 请求设置了 Thread 并且我有我需要设置的参数,但是我看不到如何从请求到请求更改 HTTP
我正在运行我的负载测试 1 小时,在测试之间我希望一个场景以 15 分钟的固定间隔运行 1 分钟。 在 jmeter 中,目前我能够模拟除突发模式之外的所有其他场景。 如何将延迟保持 15 分钟并触发
我已经通过jmeter中的bean shell脚本进行了检查,但是我没有找到 任何示例,它在jmeter中如何有用以及以哪种方式。 采样器值等 谁能用示例解释Jmeter中的bean shell 脚本
我想获取当前日期和时间作为示例日期:2014年11月10日和上午8:30或下午6:00,并将其作为参数传递给我的Jmeter测试。可以帮助我做到这一点。 最佳答案 使用__time函数: $ {__
如果我们没有在“HTTP 请求”采样器中设置任何超时,任何人都可以帮助了解 JMeter 中的默认响应时间吗? 谢谢。 最佳答案 默认为0(无超时) 设置超时的推荐方法是使用 GUI。 如果由于某种原
我正在尝试在jmeter(最新版本)上使用beanshell,但是每次添加beanshell处理器(pre,pro或其他)时,都会出现此错误 ERROR - jmeter.util.BeanShell
我的测试计划中的请求使用授权 token ,我知道该 token 将在 1 小时内过期。我需要以某种方式每 59 分钟重新请求一次 token ,直到测试完成。有人可以建议最好的方法吗 - 看起来使用
我有需要加载属性文件并将 prop 值分配给 JMeter UDV 的情况。 我已经能够成功加载属性文件,但是我无法将 prop 值分配给 UDV 我尝试了以下方法: 加载包含键值的 prop 文件(
我创建了一个集合,只是与 Loop Count 和 Ramp Up 周期混淆了。 我有一个具有以下参数的测试集。 Threads = 30 Ramp Up Period = 30 L
我对 JMeter 非常陌生,但遇到了一个问题 - 如果我将 JMeter 与远程 Node.js 一起使用,我将无法获取 jmeter 日志。 我正在通过 Maven 插件启动 JMeter,命令如
我正在尝试使用 Recording Controller 设置 JMeter 负载测试。 这会导致 Web 浏览器将进行的所有调用重复 - 包括 css 文件、js 文件和图像。 假设 Web 浏览器
我是一名优秀的程序员,十分优秀!