简体   繁体   中英

Generating HTML report with Ant 1.9.7 from Jmeter 3.0 file - “Start and end within the same entity” Error

Here is basically the build.xml that Jmeter 3.0 generated itself. When I try to run the tests with 40 000 users within an hour I get the error after 17 minutes -
"${path}/build.xml: Fatal error during transformation using ${path}/jmeter-results-detail-report_21.xsl: XML document structures must start and end within the same entity.; SystemID: file:${path}/Test.jtl;"

<?xml version="1.0"?>
<project name="ant-jmeter" default="all">
    <property name="testpath" value="${user.dir}"/>
    <property name="jmeter.home" value="${basedir}/.."/>
    <property name="report.title" value="Load Test Results"/>
    <property name="target.report.dir" location="Asjad/apache-jmeter-3.0/extras/report"/>

    <property name="test" value="Test"/>

    <property name="show-data" value="n"/>

    <property name="format" value="2.1"/>

    <condition property="style_version" value="">
        <equals arg1="${format}" arg2="2.0"/>
    </condition>

    <condition property="style_version" value="_21">
        <equals arg1="${format}" arg2="2.1"/>
    </condition>

    <condition property="funcMode">
        <equals arg1="${show-data}" arg2="y"/>
    </condition>

    <condition property="funcMode" value="false">
      <not>
        <equals arg1="${show-data}" arg2="y"/>
      </not>
    </condition>

    <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"/>

    <target name="all" depends="run,report"/>

    <target name="run">
        <echo>funcMode = ${funcMode}</echo>
        <delete file="${testpath}/${test}.html"/>
    <delete file="${testpath}/${test}.jtl"/>
        <jmeter
            jmeterhome="${jmeter.home}"
            testplan ="${testpath}/${test}.jmx"
            resultlog="${testpath}/${test}.jtl">

            <property name="jmeter.save.saveservice.output_format" value="xml"/>
            <property name="jmeter.save.saveservice.assertion_results" value="all"/>
            <property name="jmeter.save.saveservice.bytes" value="true"/>
            <property name="file_format.testlog" value="${format}"/>
            <property name="jmeter.save.saveservice.response_data.on_error" value="${funcMode}"/>
        </jmeter>
    </target>

    <property name="lib.dir" value="${jmeter.home}/lib"/>

    <path id="xslt.classpath">
        <fileset dir="${lib.dir}" includes="xalan*.jar"/>
        <fileset dir="${lib.dir}" includes="serializer*.jar"/>
    </path>

    <target name="report" depends="xslt-report">
        <echo>Report generated at ${report.datestamp}</echo>
    </target>

    <target name="xslt-report" depends="_message_xalan">
        <tstamp><format property="report.datestamp" pattern="yyyy/MM/dd HH:mm"/></tstamp>
        <xslt
            classpathref="xslt.classpath"
            force="true"
            in="${testpath}/${test}.jtl"
            out="${testpath}/${test}.html"
            style="${basedir}/jmeter-results-detail-report_21.xsl">
            <param name="showData" expression="${show-data}"/>
            <param name="titleReport" expression="${report.title}"/>
            <param name="dateReport" expression="${report.datestamp}"/>
        </xslt>
    </target>

        <condition property="xalan.present">
           <and>
             <available classpathref="xslt.classpath" classname="org.apache.xalan.processor.TransformerFactoryImpl"/>
             <available classpathref="xslt.classpath" classname="org.apache.xml.serializer.ExtendedContentHandler"/>
         </and>
       </condition>

     <target name="_message_xalan" unless="xalan.present">
         <echo>Cannot find all xalan and/or serialiser jars</echo>
        <echo>The XSLT formatting may not work correctly.</echo>
        <echo>Check you have xalan and serializer jars in ${lib.dir}</echo>
     </target>

</project>

It is a simple test that just makes requests to the webpage.
I am using Ant build 1.9.7 and Jmeter 3.0.

I can think of 2 possible reasons:

  1. Ant might be trying to convert .jtl to HTML when the .jtl is incomplete. In order to work that around:

    • Add the next line to <jmeter> section:

       <property name="jmeter.save.saveservice.autoflush" value="true"/> 
    • Or alternatively put add the following line to user.properties file (lives in JMeter's "bin" folder)

       jmeter.save.saveservice.autoflush=true 

    It will "tell" JMeter to store the results as soon as they arrive.

  2. 40 000 users is quite a "heavy" load and JMeter default configuration might not be suitable for this. I believe you need to add at least some Java Heap space . In case of Ant it would be adding the next lines to <jmeter> section:

     <jvmarg value="-Xmx8G"/> 

    Change that 8G reference value to be around 80% of your available physical RAM. See 9 Easy Solutions for a JMeter Load Test “Out of Memory” Failure guide for more recommendations on JMeter tuning for maximum performance

Showing your jmeter.log file (jmeter 3.0 will tell you where it is generated) will help.

But you may be facing this bug if using ANT + XSL to generated report:

See this :

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM