2
votes

I am running a few jmeter test plans together through jmeter-maven-plugin. I can see jtl files generated for each test plan. But the file content is in xml. I tried modifying the pom file to have resultsFileFormat as csv but it still generates xml format jtl file. My current plugin config looks like this,

`<plugins>
 <plugin>
 <groupId>com.lazerycode.jmeter</groupId>
 <artifactId>jmeter-maven-plugin</artifactId>
 <version>2.0.3</version>
            <executions>
                <execution>
                    <id>jmeter-tests</id>
                    <phase>verify</phase>
                    <goals>
                        <goal>jmeter</goal>
                    </goals>
                    <configuration>
                            <resultsFileFormat>csv</resultsFileFormat>
                            <propertiesJMeter>
                                <jmeter.save.saveservice.print_field_names>true</jmeter.save.saveservice.print_field_names>
                                <jmeter.save.saveservice.successful>true</jmeter.save.saveservice.successful>
                                <jmeter.save.saveservice.label>true</jmeter.save.saveservice.label>
                                <jmeter.save.saveservice.time>true</jmeter.save.saveservice.time>
                            </propertiesJMeter>
                    </configuration>
                </execution>
            </executions>
        </plugin>

    </plugins>

Please let me know how I could make the jtl content to be generated as csv.

1
There was a bug in version 2.0.3 of the plugin that caused < resultsFileFormat> to be ignored. It's fixed in 2.1.0.Ardesco

1 Answers

3
votes

You need to do it a little bit differently, your settings should go to the <propertiesUser> section like:

<execution>
    <id>jmeter-tests</id>
    <phase>verify</phase>
    <goals>
        <goal>jmeter</goal>
    </goals>
    <configuration>
        <propertiesUser>
            <jmeter.save.saveservice.output_format>csv</jmeter.save.saveservice.output_format>
            <jmeter.save.saveservice.print_field_names>true</jmeter.save.saveservice.print_field_names>
            <jmeter.save.saveservice.successful>true</jmeter.save.saveservice.successful>
            <jmeter.save.saveservice.label>true</jmeter.save.saveservice.label>
            <jmeter.save.saveservice.time>true</jmeter.save.saveservice.time>
        </propertiesUser>
    </configuration>
</execution>

Or alternatively create your own user.properties file with the following lines:

jmeter.save.saveservice.label=true
jmeter.save.saveservice.time=true
jmeter.save.saveservice.successful=true
jmeter.save.saveservice.output_format=csv
jmeter.save.saveservice.print_field_names=true

and drop it to "/src/test/jmeter" folder (where your .JMX files live)

As far as I'm aware, JMeter Maven plugin uses XML results file format by default and this configuration is applied via jmeter.properties file.

JMeter properties have the following overrides:

  1. jmeter.properties
  2. user.properties
  3. command-line arguments

So you can override a property stored in jmeter.properties file via setting the same property in user.properties file and override the property originating from user.properties via -J command-line argument.

References: