NonGUIDriver 中的错误 - CannotResolveClassException:kg.apc.jmeter.reporters.AutoStop

Error in NonGUIDriver - CannotResolveClassException: kg.apc.jmeter.reporters.AutoStop

我正在尝试使用 maven jmeter 插件测试 jmeter 测试并看到以下错误

由于测试计划中的 AutoStop 侦听器,我认为它失败了,我已经在 lib/ext 中更新了插件-manager.jar,但没有用

我使用的Jmeter版本:

Jmeter maven插件版本:3.4.0

Jmeter="5.3"

JmeterTestPlan version="1.2"

错误:

--- jmeter-maven-plugin:3.4.0:jmeter (jmeter-tests) @ demo-porject ---
[INFO]
[INFO] -------------------------------------------------------
[INFO]  P E R F O R M A N C E    T E S T S
[INFO] -------------------------------------------------------
[INFO]
[INFO] Executing test: jmeter-newtest.jmx
[INFO] Arguments for forked JMeter JVM: [java, -Xms512M, -Xmx512M, -Djava.awt.headless=true, -jar, ApacheJMeter-5.4.1.jar, -d, C:\Users\sreeja\GitHub\demo-project\targetad5233-a982-4b28-a804-0c743e6034b0\jmeter, -j, C:\Users\sreeja\GitHub\demo-project\target\jmeter\logs\jmeter-newtest.jmx.log, -l,C:\Users\sreeja\GitHub\demo-project\target\jmeter\results210720-jmeter-newtest.csv, -n, -t, C:\Users\sreeja\GitHub\demo-project\target\jmeter\testFiles\jmeter-newtest.jmx, -Dsun.net.http.allowRestrictedHeaders, true]
[INFO]
[INFO] Error in NonGUIDriver java.lang.IllegalArgumentException: Problem loading XML from:'C:\Users\sreeja\GitHub\demo-project\target\jmeter\testFiles\jmeter-newtest.jmx'.
[INFO] Cause:
[INFO] CannotResolveClassException: kg.apc.jmeter.reporters.AutoStop
[INFO]
[INFO]  Detail:com.thoughtworks.xstream.converters.ConversionException:
[INFO] ---- Debugging information ----
[INFO] cause-exception     : com.thoughtworks.xstream.converters.ConversionException
[INFO] cause-message       :
[INFO] first-jmeter-class  : org.apache.jmeter.save.converters.HashTreeConverter.unmarshal(HashTreeConverter.java:66)
[INFO] class               : org.apache.jmeter.save.ScriptWrapper
[INFO] required-type       : org.apache.jmeter.save.ScriptWrapper
[INFO] converter-type      : org.apache.jmeter.save.ScriptWrapperConverter
[INFO] path                : /jmeterTestPlan/hashTree/hashTree/hashTree[3]/kg.apc.jmeter.reporters.AutoStop
[INFO] line number         : 228
[INFO] version             : 5.4.1
[INFO] -------------------------------
[INFO] An error occurred: Error in NonGUIDriver Problem loading XML from:'C:\Users\sreeja\GitHub\demo-project\target\jmeter\testFiles\jmeter-newtest.jmx'.
[INFO] Cause:
[INFO] CannotResolveClassException: kg.apc.jmeter.reporters.AutoStop
[INFO]
[INFO]  Detail:com.thoughtworks.xstream.converters.ConversionException:
[INFO] ---- Debugging information ----
[INFO] cause-exception     : com.thoughtworks.xstream.converters.ConversionException
[INFO] cause-message       :
[INFO] first-jmeter-class  : org.apache.jmeter.save.converters.HashTreeConverter.unmarshal(HashTreeConverter.java:66)
[INFO] class               : org.apache.jmeter.save.ScriptWrapper
[INFO] required-type       : org.apache.jmeter.save.ScriptWrapper
[INFO] converter-type      : org.apache.jmeter.save.ScriptWrapperConverter
[INFO] path                : /jmeterTestPlan/hashTree/hashTree/hashTree[3]/kg.apc.jmeter.reporters.AutoStop
[INFO] line number         : 228
[INFO] version             : 5.4.1
[INFO] -------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  05:35 min
[INFO] Finished at: 2021-07-20T17:42:14+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.lazerycode.jmeter:jmeter-maven-plugin:3.4.0:jmeter (jmeter-tests) on project demo-project: Test failed with exit code:1 -> [Help
1]

您需要添加插件到 jmeterExtensions

You can add any additional Java libraries to JMeter's lib/ext directory by using the <jmeterExtensions> configuration element

                <configuration>
                    <jmeterExtensions>
                        <artifact>kg.apc:jmeter-plugins-autostop:0.1</artifact>
                    </jmeterExtensions>
                </configuration>
            </plugin>
        </plugins>
    </build>

将以下部分添加到您的 pom.xml 文件中:

<configuration>
    <jmeterExtensions>
        <artifact>kg.apc:jmeter-plugins-autostop:0.1</artifact>
    </jmeterExtensions>
</configuration>

如果您的测试使用其他插件 - 您将需要以类似的方式一一声明它们,每个插件使用一个 <artifact> 标签

更多信息: