I have something like this in my jmx file of jmeter:
<stringProp name="SoapSampler.URL_DATA">http://192.168.0.1:8080/abc/Service</stringProp>
I'm using jmeter maven plugin to get the performance test result when doing the maven build. It's working perfectly.
Now I changed that to a user defined variable in jmeter and try to run that. I get the following error:
"SAXParseException: Content is not allowed in prolog"
Changes in jmx file:
<elementProp name="server" elementType="Argument">
<stringProp name="Argument.name">server</stringProp>
<stringProp name="Argument.value">http://192.168.0.1:8080</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<stringProp name="SoapSampler.URL_DATA">${server}/abc/Service</stringProp>
However the modified changes works perfectly if executed directly from jmeter GUI. Fails only when executed during maven build.
Here is my pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.abc.def.performance</groupId>
<artifactId>abc-performance</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>1.9.0</version>
<executions>
<execution>
<id>jmeter-tests</id>
<phase>verify</phase>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
</executions>
<configuration>
</configuration>
</plugin>
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-analysis-maven-plugin</artifactId>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>analyze</goal>
</goals>
<configuration>
<!-- An AntPath-Style pattern matching a JMeter XML result file to
analyze. Must be a fully qualified path. File may be GZiped, must end in
.gz then. Default: not set. Required. -->
<source>${project.build.directory}/**/*.jtl</source>
<!-- directory where to store analysis result files. Default: ${project.build.directory}
Required. -->
<targetDirectory>${project.build.directory}/results</targetDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Make sure jmeter.save.saveservice.output_format=xml
and
Uncomment below lines from your jmeter.properties file (inside bin folder of jmeter installation folder):
jmeter.save.saveservice.output_format=xml
jmeter.save.saveservice.data_type=true
jmeter.save.saveservice.label=true
jmeter.save.saveservice.response_code=true
jmeter.save.saveservice.successful=true
jmeter.save.saveservice.thread_name=true