【问题标题】:JMeter error while running from Jenkins "java.lang.NumberFormatException: For input string: "timeStamp"从 Jenkins 运行时出现 JMeter 错误“java.lang.NumberFormatException:对于输入字符串:“timeStamp”
【发布时间】:2016-11-16 11:30:33
【问题描述】:

通过 Jenkins 运行 JMeter 脚本时出现以下错误。无法找出导致错误的原因。

Performance: Failed to parse file 'C:\Program Files (x86)\Jenkins\jobs\JMeter Test\builds\12\performance-reports\JMeter\test.jtl': For input string: "timeStamp"
java.lang.NumberFormatException: For input string: "timeStamp"
    at java.lang.NumberFormatException.forInputString(Unknown Source)
    at java.lang.Long.parseLong(Unknown Source)
    at java.lang.Long.valueOf(Unknown Source)
    at hudson.plugins.performance.JMeterCsvParser.getSample(JMeterCsvParser.java:153)
    at hudson.plugins.performance.JMeterCsvParser.parse(JMeterCsvParser.java:124)
    at hudson.plugins.performance.JMeterParser.parseCsv(JMeterParser.java:189)
    at hudson.plugins.performance.JMeterParser.parse(JMeterParser.java:48)
    at hudson.plugins.performance.AbstractParser.parse(AbstractParser.java:56)
    at hudson.plugins.performance.PerformancePublisher.perform(PerformancePublisher.java:347)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782)
    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:723)
    at hudson.model.Build$BuildExecution.post2(Build.java:185)
    at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:668)
    at hudson.model.Run.execute(Run.java:1763)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:410)
Email was triggered for: Always
Sending email for trigger: Always
Finished: SUCCESS

下面是test.jtl文件的内容

timeStamp,elapsed,label,responseCode,responseMessage,threadName,dataType,success,failureMessage,bytes,grpThreads,allThreads,Latency,IdleTime
1468432148291,2027,178 /BOT/,Non HTTP response code: java.net.ConnectException,Non HTTP response message: Connection refused: connect,Clock-in / Clock-out Tests 1-1,text,false,,2204,7,7,0,0
1468432148608,2020,178 /BOT/,Non HTTP response code: java.net.ConnectException,Non HTTP response message: Connection refused: connect,Clock-in / Clock-out Tests 1-2,text,false,,2204,8,8,0,0
1468432148941,2024,178 /BOT/,Non HTTP response code: java.net.ConnectException,Non HTTP response message: Connection refused: connect,Clock-in / Clock-out Tests 1-3,text,false,,2204,9,9,0,0
1468432149255,1993,178 /BOT/,Non HTTP response code: java.net.ConnectException,Non HTTP response message: Connection refused: connect,Clock-in / Clock-out Tests 1-4,text,false,,2204,9,9,0,0

【问题讨论】:

  • 对 jenkins/jmeter 不太熟悉,但我建议从 jtl 文件中删除第一行(标题)。
  • 谢谢@lucasvw。您对标题行创建问题是正确的。我将 text.jtl 的输出格式从 csv 更改为 xml,现在问题消失了。

标签: java jenkins jmeter


【解决方案1】:

根据Continuous Integration 101: How to Run JMeter With Jenkins 文章,这可能是由于格式不匹配,即Jenkins Performance Plugin 需要 XML 并获取 CSV。

对于您的前几次运行,我建议使用以下方法之一“告诉”JMeter 以 XML 格式存储其结果

  • 将 ``jmeter.save.saveservice.output_format=xml 行添加到 user.properties 文件(位于您的 /bin 文件夹中) JMeter 安装

  • 通过-J命令行参数传递属性,如:C:\jmeter\bin\jmeter.bat -Jjmeter.save.saveservice.output_format=xml -n -t C:\jmeter\extras\Test.jmx -l Test.jtl

您还可以将 CSV 文件与性能插件一起使用。但是,这需要额外的配置,而 XML 文件可以开箱即用。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-06-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-05
    • 2013-09-04
    • 1970-01-01
    相关资源
    最近更新 更多