使用Jmeter Maven插件运行JMX监视器收集器侦听器

时间:2015-06-30 09:14:42

标签: jmeter monitoring jmx jmeter-maven-plugin

我使用Jmeter maven插件执行jmx测试文件,在GUI压力测试和Web服务测试中表现良好:

DisplayObject

然后我需要在我的Jmeter disktop应用程序(Jmeter 2.9)中添加一个JMXMon Samples Collector监听器类型的监听器,该监听器用于在测试运行时绘制JMX性能指标,更新的jmeter测试工作正常Jmeter 2.9,这里是听众的一部分:

<plugin>
        <groupId>com.lazerycode.jmeter</groupId>
        <artifactId>jmeter-maven-plugin</artifactId>
        <version>1.10.1</version>
        <executions>
            <execution>
                <id>jmeter-test</id>
                <phase>test</phase>
                <goals>
                    <goal>jmeter</goal>
                </goals>
                <configuration>
                    <overrideRootLogLevel>debug</overrideRootLogLevel>
                    <testFilesIncluded>
                        <jMeterTestFile>pim_stress.jmx</jMeterTestFile>
                    </testFilesIncluded>
                    <resultsFileNameDateFormat>ddMMyyyy</resultsFileNameDateFormat>
                    <ignoreResultFailures>false</ignoreResultFailures>
                    <propertiesUser>
                        <threadgroup.numberOfThreads>10</threadgroup.numberOfThreads>
                        <threadgroup.rampUp>1</threadgroup.rampUp>
                        <threadgroup.host>localhost</threadgroup.host>
                        <threadgroup.port>8332</threadgroup.port>
                    </propertiesUser>
                    <workingDirectory>target/</workingDirectory>
                </configuration>
            </execution>
        </executions>
</plugin>

但是当我试图通过Jmeter maven插件运行此测试计划(jmx文件)时(出于测试自动化原因),它返回错误:

        <kg.apc.jmeter.jmxmon.JMXMonCollector guiclass="kg.apc.jmeter.vizualizers.JMXMonGui" testclass="kg.apc.jmeter.jmxmon.JMXMonCollector" testname="jp@gc - JMXMon Samples Collector" enabled="true">
          <boolProp name="ResultCollector.error_logging">false</boolProp>
          <objProp>
            <name>saveConfig</name>
            <value class="SampleSaveConfiguration">
              <time>true</time>
              <latency>true</latency>
              <timestamp>true</timestamp>
              <success>true</success>
              <label>true</label>
              <code>true</code>
              <message>true</message>
              <threadName>true</threadName>
              <dataType>true</dataType>
              <encoding>false</encoding>
              <assertions>true</assertions>
              <subresults>true</subresults>
              <responseData>false</responseData>
              <samplerData>false</samplerData>
              <xml>false</xml>
              <fieldNames>false</fieldNames>
              <responseHeaders>false</responseHeaders>
              <requestHeaders>false</requestHeaders>
              <responseDataOnError>false</responseDataOnError>
              <saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
              <assertionsResultsToSave>0</assertionsResultsToSave>
              <bytes>true</bytes>
            </value>
          </objProp>
          <stringProp name="filename">${__P(result.monitoring)}</stringProp>
          <longProp name="interval_grouping">1000</longProp>
          <boolProp name="graph_aggregated">false</boolProp>
          <stringProp name="include_sample_labels"></stringProp>
          <stringProp name="exclude_sample_labels"></stringProp>
          <stringProp name="start_offset"></stringProp>
          <stringProp name="end_offset"></stringProp>
          <boolProp name="include_checkbox_state">false</boolProp>
          <boolProp name="exclude_checkbox_state">false</boolProp>
          <collectionProp name="samplers">
            <collectionProp name="-362669779">
              <stringProp name="868201267">NbSessionsTotal</stringProp>
              <stringProp name="942166118">service:jmx:remoting-jmx://localhost:4697</stringProp>
              <stringProp name="105365">jmx</stringProp>
              <stringProp name="-1255434677">jmxadmin@1</stringProp>
              <stringProp name="377390660">pim.monitoring:service=JmxSystem</stringProp>
              <stringProp name="868201267">NbSessionsTotal</stringProp>
              <stringProp name="0"></stringProp>
              <stringProp name="1237">false</stringProp>
            </collectionProp>
          </collectionProp>
        </kg.apc.jmeter.jmxmon.JMXMonCollector>

有人有想法吗?...提前多多感谢!

1 个答案:

答案 0 :(得分:1)

我认为您添加了JMeter插件以使用JMeter GUI实例,但在jmeter-maven-plugin配置中省略了此步骤。如果您需要使用带有maven的非标准插件运行JMeter测试计划,您还需要配置jmeter-maven插件:

https://github.com/jmeter-maven-plugin/jmeter-maven-plugin/wiki/Adding-additional-libraries-to-the-classpath#adding-jars-to-the-libext-directory