一尘不染

使用Ant运行JMeter 3.0测试时生成错误报告

jmeter

我已经待了好几天了。基本上,我想使用Ant从JMeter测试文件创建HTML报告。我正在使用Linux Ubuntu
16.04.1。这是我的build.xml:

<project name="performance-tests" default="run-performance-tests" basedir=".">
<property name="testpath" value="${user.dir}"/>
<poperty name="jmeter.home" value="/home/richard/Asjad/apache-jmeter-3.0"/>

<!-- Name of test (without .jmx) -->
<property name="test" value="Test"/>

<path id="jmeter.path">
  <fileset dir="${basedir}" includes="/*.jar" />
</path>

<target name="run-performance-tests">
  <delete dir="${basedir}/target" quiet="true" failonerror="false"/>
<mkdir dir="${basedir}/target"/>

<!-- Allow jar to be picked up locally -->
<path id="jmeter.classpath">
    <fileset dir="${basedir}">
      <include name="ant-jmeter*.jar"/>
    </fileset>
</path>

  <taskdef name="jmeter"
    classpathref="jmeter.classpath"
    classname="org.programmerplanet.ant.taskdefs.jmeter.JMeterTask" />
  <echo message="Running load tests in testing.xml"/>
  <jmeter
       jmeterhome="${jmeter.home}"
       testplan ="${testpath}/${test}.jmx"
       resultlog="${basedir}/target/JMeterResults.xml">
    <jvmarg value="-Xincgc"/>
    <jvmarg value="-Xmx512m"/>
    <jvmarg value="-Dproperty=value"/>
    <property name="request.threads" value="5"/>
    <property name="request.loop" value="50"/>
    <property name="jmeter.save.saveservice.assertion_results" value="all"/>
    <property name="jmeter.save.saveservice.output_format" value="xml"/>

  </jmeter>
  <xslt in="${basedir}/target/JMeterResults.xml"
    out="${basedir}/target/Test.html"
    style="${basedir}/jmeter-results-detail-report.xsl"/>
</target>

这是我运行脚本时看到的:

Buildfile: /home/richard/Asjad/apache-jmeter-3.0/extras/build.xml

run-performance-tests:
   [delete] Deleting directory /home/richard/Asjad/apache-jmeter-3.0/extras/target
    [mkdir] Created dir: /home/richard/Asjad/apache-jmeter-3.0/extras/target
     [echo] Running load tests in testing.xml
   [jmeter] Executing test plan: /home/richard/Asjad/apache-jmeter-3.0/extras/TestPlan/Test.jmx ==> /home/richard/Asjad/apache-jmeter-3.0/extras/target/JMeterResults.xml
   [jmeter] Java HotSpot(TM) 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release
   [jmeter] Writing log file to: /home/richard/Asjad/apache-jmeter-3.0/bin/jmeter.log
   [jmeter] Creating summariser <summary>
   [jmeter] Created the tree successfully using /home/richard/Asjad/apache-jmeter-3.0/extras/TestPlan/Test.jmx
   [jmeter] Starting the test @ Fri Jul 29 11:57:25 EEST 2016 (1469782645099)
   [jmeter] Waiting for possible Shutdown/StopTestNow/Heapdump message on port 4445
   [jmeter] summary =     10 in 00:00:02 =    4.6/s Avg:   214 Min:   105 Max:   344 Err:     0 (0.00%)
   [jmeter] Tidying up ...    @ Fri Jul 29 11:57:27 EEST 2016 (1469782647345)
   [jmeter] ... end of run
     [xslt] Processing /home/richard/Asjad/apache-jmeter-3.0/extras/target/JMeterResults.xml to /home/richard/Asjad/apache-jmeter-3.0/extras/target/Result_One.html
     [xslt] Loading stylesheet /home/richard/Asjad/apache-jmeter-3.0/extras/jmeter-results-detail-report.xsl

BUILD SUCCESSFUL
Total time: 3 seconds

构建成功,然后给了我一个HTML文件,当我打开它时,我看到了: HTML报告

如果有人至少可以告诉我我应该走的错误或方向,我将非常感激。


阅读 246

收藏
2020-07-24

共1个答案

一尘不染

看来JMeter开发人员破坏了jmeter-results-detail-report.xsl档案,错误报告在这里:

为了恢复以前的行为,请执行以下步骤:

  1. 下载apache-jmeter-2.13.zip
  2. jmeter-results-detail-report_21.xslapache-jmeter-2.13/extras文件夹中提取文件并将其拖放到JMeter 3.0安装的“ extras”文件夹中
  3. 修改您的build.xml文件以使用如下jmeter-results-detail-report_21.xsl文件:
    <xslt in="${basedir}/target/JMeterResults.xml"
    out="${basedir}/target/Test.html"
    style="${basedir}/jmeter-results-detail-report_21.xsl"/>
    

或者,您可以从此处获取XSLT文件

有关将JMeter
XML结果文件转换为HTML格式的更多详细信息,请参见可视化以.xsl样式表查看的JMeter
.jtl文件

2020-07-24