无法使用从MAVEN创建的JAR直接运行Jmeter性能测试 [英] Not able to run Jmeter Performance Test directly using the JAR created from MAVEN

查看:44
本文介绍了无法使用从MAVEN创建的JAR直接运行Jmeter性能测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直试图通过MAVEN运行一个Jmeter脚本,我能够使用命令来做到这一点"mvn验证",并且还可以在/target文件夹中查看报告

I have been trying to run one Jmeter script through MAVEN, I was able to do that using command "mvn verify" and able to see the reports also inside /target folder

但是,我想直接通过运行"mvn verify"命令后创建的JAR运行Jmeter性能测试.

However, I want to run the Jmeter Performance Test directly through the JAR which is created after running the "mvn verify" command.

下面是我的POM.xml

Below is my POM.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.example</groupId>
  <artifactId>jmeter-testproject</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>jmeter-testproject</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <plugins>
        <plugin>
        <groupId>com.lazerycode.jmeter</groupId>
        <artifactId>jmeter-maven-plugin</artifactId>
        <version>2.1.0</version>
        <executions>
        <execution>
            <id>jmeter-tests</id>
            <goals>
            <goal>jmeter</goal>
            </goals>
        </execution>
        </executions>
    </plugin>   
    </plugins>
  </build>
</project>

运行"mvn verify"并创建jmeter-testproject-1.0-SNAPSHOT之后,正在生成/target文件夹.

A /target folder is being generated after running "mvn verify" and also jmeter-testproject-1.0-SNAPSHOT created.

但是,如果我想通过直接执行JAR来运行程序包,则只给出"Hello World"作为输出,该输出存在于主类中.我希望在直接单击JAR之后也要执行Jmeter性能测试.请帮忙.

However, if I want to run the package by directly executing the JAR, it's giving just "Hello World" as an output which is present in the main class. I want the Jmeter Performance Test also to execute after directly clicking the JAR. Please help.

在此处输入图片描述

推荐答案

使用jmeter-maven-plugin无法做到这一点.

You can't do this with the jmeter-maven-plugin.

jmeter-maven-plugin正在接受您的测试计划/配置,然后为您运行JMeter进程.

The jmeter-maven-plugin is taking your test plan/configuration and then running a JMeter process for you.

这并不是在物理上构建一个可运行的jar,其中包含您需要的所有内容才能运行性能测试.

It is not physically building a runnable jar with everything that you need inside it to be able to run performance tests.

这篇关于无法使用从MAVEN创建的JAR直接运行Jmeter性能测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆