Sonarqube + Jmeter error in jtl file

2019-09-17 09:18发布

问题:

i install Sonarqube with Jmeter Plugin. I have my simple test in Jmeter with:

Threads group
   Http Sampler
       Assertion Results

and i save the result in local, with jtl extension.

Now i have configure Local jtl file in jmeter plugin for sonar, for my project.

But now if i try to test my project i have this error:

ERROR - Cannot analyse project 'My project'
es.excentia.jmeter.report.server.testresults.JtlReaderException: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '1' (code 49) in prolog; expected '<'

回答1:

It looks like that sonarqube expects JMeter result file to be in XML format and by default it is CSV.

Results file output format is controllable via jmeter.save.saveservice.output_format property, supported values are xml and csv, default is csv.

Depending on how you launch your JMeter test the property can be set in different ways:

  1. Add the next line to user.properties file which lives under /bin folder of your JMeter installation

    jmeter.save.saveservice.output_format=xml
    
  2. Look for this property in jmeter.properties file, uncomment and change its value to xml

  3. If you run JMeter in command-line mode the property can be passed via -J argument as

    jmeter -Jjmeter.save.saveservice.output_format=xml -n -t /path/to/your/test/plan.jmx -l /path/to/results/file/jtl
    

See Apache JMeter Properties Customization Guide for comprehensive information on JMeter's property types and ways of overriding.