【问题标题】:Not able to run Jmeter Performance Test directly using the JAR created from MAVEN无法使用从 MAVEN 创建的 JAR 直接运行 Jmeter 性能测试
【发布时间】:2020-06-24 23:28:36
【问题描述】:

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

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

下面是我的 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 文件夹。

但是,如果我想通过直接执行 JAR 来运行包,它只会给出“Hello World”作为主类中存在的输出。我希望在直接单击 JAR 后也执行 Jmeter 性能测试。请帮忙。

enter image description here

【问题讨论】:

    标签: executable-jar jmeter-maven-plugin


    【解决方案1】:

    你不能用 jmeter-maven-plugin 做到这一点。

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

    它并不是在物理上构建一个可运行的 jar,其中包含运行性能测试所需的一切。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-04-10
      • 1970-01-01
      • 2020-03-18
      • 2014-04-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多