简体   繁体   English

Jmeter-Ant xslt-report:BUILD FAILED Test.jtl 不存在错误,尽管我有 Test.jtl

[英]Jmeter-Ant xslt-report: BUILD FAILED Test.jtl does not exist error although i have Test.jtl

I am trying to run my Test.jmx file through below ant cmd: C:\\apache-ant-1.10.1-bin\\bin>ant我正在尝试通过以下 ant cmd 运行我的 Test.jmx 文件: C:\\apache-ant-1.10.1-bin\\bin>ant

I got the following error:我收到以下错误:

C:\apache-ant-1.10.1-bin\bin>ant
Buildfile: C:\apache-ant-1.10.1-bin\bin\build.xml

run:
     [echo] funcMode = false
   [jmeter] Executing test plan: C:\apache-ant-1.10.1-bin\bin\Test.jmx ==> C:\apache-ant-1.10.1-bin\bin\Test.jtl

_message_xalan:

xslt-report:

BUILD FAILED
C:\apache-ant-1.10.1-bin\bin\build.xml:124: input file C:\apache-ant-1.10.1-bin\bin\Test.jtl does not exist

Total time: 4 seconds

C:\apache-ant-1.10.1-bin\bin>

I fixed this issue by creating a new Test.jtl file.我通过创建一个新的 Test.jtl 文件解决了这个问题。

Now I am getting this error:现在我收到此错误:

C:\apache-ant-1.10.1-bin\bin>ant -Dtestpath=C:\apache-ant-1.10.1-bin\bin\ -Dtest=Test
Buildfile: C:\apache-ant-1.10.1-bin\bin\build.xml

run:
     [echo] funcMode = false
   [jmeter] Executing test plan: C:\apache-ant-1.10.1-bin\bin\Test.jmx ==> C:\apache-ant-1.10.1-bin\bin\Test.jtl

_message_xalan:

xslt-report:
     [xslt] Processing C:\apache-ant-1.10.1-bin\bin\Test.jtl to C:\apache-ant-1.10.1-bin\bin\Test.html
     [xslt] Loading stylesheet C:\apache-ant-1.10.1-bin\bin\jmeter-results-report_21.xsl
     [xslt] C:\apache-ant-1.10.1-bin\bin\Test.jtl:1:1: Fatal Error! Premature end of file.
     [xslt] Failed to process C:\apache-ant-1.10.1-bin\bin\Test.jtl

BUILD FAILED
C:\apache-ant-1.10.1-bin\bin\build.xml:124: Fatal error during transformation using C:\apache-ant-1.10.1-bin\bin\jmeter-results-report_21.xsl: Premature end of file.; SystemID: file:/C:/apache-ant-1.10.1-bin/bin/Test.jtl; Line#: 1; Column#: 1

Total time: 3 seconds

Most likely your JMeter test is failing therefore it doesn't generate result file.很可能您的 JMeter 测试失败,因此它不会生成结果文件。 I would suggest amending your target like我建议修改你的目标

    <jmeter
        jmeterhome="${jmeter.home}"
        testplan ="${testpath}/${test}.jmx"
        resultlog="${testpath}/${test}.jtl"
        jmeterlogfile="${testpath}/jmeter.log> 

in build.xml file.build.xml文件中。 The last line will "tell" the JMeter Ant task to generate jmeter.log file under the ${testpath} , you should be able to figure out what goes wrong by looking into this file.最后一行将“告诉”JMeter Ant 任务在${testpath}下生成jmeter.log文件,您应该能够通过查看此文件找出问题所在。

References:参考:

Actually, the correct answer is here .其实,正确答案在这里 Just need to remove the comments from these lines:只需要从这些行中删除注释:

<jvmarg value="-Xincgc"/>
<jvmarg value="-Xmx128m"/>
<jvmarg value="-Dproperty=value"/>
<jmeterarg value="-qextra.properties"/>

in the extracts\\build.xml file.extracts\\build.xml文件中。

Adding to @Dmitri T answer jtl file is created only if you execute at least 1 Sample, so it won't be created in the following cases:添加到@Dmitri T answer jtl 文件仅在您执行至少 1 个示例时创建,因此在以下情况下不会创建它:

  1. Your test plan failed and Stopped before executing Sampler您的测试计划在执行 Sampler 之前失败并已停止

  2. Your test doesn't contain Samplers您的测试不包含采样器

  3. Your configuration is wrong and no thread were executed ( for example Thread number is 0)您的配置错误,没有线程被执行(例如线程号为0)

You can try to execute/view/debug in GUI mode and check what's wrong.您可以尝试在 GUI 模式下执行/查看/调试并检查有什么问题。

use "resultlogdir" instead of "resultlog" so change the build.xml like this:使用“resultlogdir”而不是“resultlog”,因此像这样更改build.xml:

<jmeter
jmeterhome="${jmeter.home}"
testplan ="${testpath}/${test}.jmx"
resultlogdir="${testpath}/log">

and also the "in" property in : in="${testpath}/log/${test}.jtl"以及“in”属性:in="${testpath}/log/${test}.jtl"

I have no idea how to explain why, but it worked in my computer我不知道如何解释原因,但它在我的电脑上工作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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