Reputation: 159
In the pom.xml file, I set the following variables and running the JMeter script from maven using the following command. But it doesn't work. This means the thread is not running with 10 users. Can you please help me with this? Also, in JMeter do I need to set anything?
Maven Command:
mvn -DJmeterTestFile=ER_SampleTest -DRampUp=2 -DLoopcount=1 -DThreadcount=10 verify
My pom.xml is as follows:
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>jmeter-demo</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>jmeter-demo</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-client</artifactId>
<version>9.1.1.v20140108</version>
<classifier>hybrid</classifier>
</dependency>
<dependency>
<groupId>org.apache.jmeter</groupId>
<artifactId>ApacheJMeter</artifactId>
<version>2.10</version>
</dependency>
<dependency>
<groupId>org.apache.jmeter</groupId>
<artifactId>ApacheJMeter_core</artifactId>
<version>2.10</version>
</dependency>
<dependency>
<groupId>org.apache.jmeter</groupId>
<artifactId>ApacheJMeter_http</artifactId>
<version>2.10</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>2.7.0</version>
<executions>
<execution>
<id>jmeter-tests</id>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<executions>
<execution>
<id>default-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<!-- This configuraition is to specify jmeter script, number -->
<testFilesIncluded>
<jMeterTestFile>${JmeterTestFile}.jmx</jMeterTestFile>
</testFilesIncluded>
<testResultsTimestamp>false</testResultsTimestamp>
<propertiesUser>
<Threadcount>${Threadcount}</Threadcount>
<Loopcount>${Loopcount}</Loopcount>
<Rampup>${RampUp}</Rampup>
</propertiesUser>
<testPlanLibraries>
<artifact>org.apache.activemq:activemq-spring:5.15.2</artifact>
<artifact>org.apache.activemq:activemq-client:5.15.2</artifact>
<artifact>org.apache.activemq:activemq-broker:5.15.2</artifact>
</testPlanLibraries>
<excludedArtifacts>
<exclusion>commons-pool2:commons-pool2</exclusion>
<exclusion>commons-math3:commons-math3</exclusion>
<exclusion>org.slf4j:slf4j-nop</exclusion>
<exclusion>logkit:logkit</exclusion>
<exclusion>avalon-logkit:avalon-logkit</exclusion>
<exclusion>jdom:jdom</exclusion>
<exclusion>log4j:log4j</exclusion>
<exclusion>commons-logging:commons-logging</exclusion>
<exclusion>excalibur-logger:excalibur-logger</exclusion>
</excludedArtifacts>
<jmeterExtensions>
<artifact>kg.apc:jmeter-plugins-casutg:2.4</artifact>
</jmeterExtensions>
<downloadExtensionDependencies>false</downloadExtensionDependencies>
<excludes>
<exclude>**/JMeter/plugins/functional/controler/**/*</exclude>
<exclude>**/JMeter/plugins/controler/websocketapp/**</exclude>
</excludes>
<junitLibraries>
<artifact>com.lazerycode.junit:junit-test:1.0.0</artifact>
</junitLibraries>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
Upvotes: 1
Views: 1517
Reputation: 168092
You need to define your properties like JmeterTestFile
, Threadcount
, etc. in <properties>
section like:
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<JmeterTestFile>test</JmeterTestFile>
<Threadcount>10</Threadcount>
<Loopcount>5</Loopcount>
<RampUp>1</RampUp>
</properties>
<configuration>
section from maven-jar-plugin
to jmeter-maven-plugin
${__P(Threadcount,)}
. Example pom.xml file (you might still need to amend it as I don't have idea what else it should be doing apart from running JMeter tests)
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>jmeter-demo</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>jmeter-demo</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-client</artifactId>
<version>9.1.1.v20140108</version>
<classifier>hybrid</classifier>
</dependency>
<dependency>
<groupId>org.apache.jmeter</groupId>
<artifactId>ApacheJMeter</artifactId>
<version>4.0</version>
</dependency>
<dependency>
<groupId>org.apache.jmeter</groupId>
<artifactId>ApacheJMeter_core</artifactId>
<version>4.0</version>
</dependency>
<dependency>
<groupId>org.apache.jmeter</groupId>
<artifactId>ApacheJMeter_http</artifactId>
<version>4.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>2.7.0</version>
<executions>
<execution>
<id>jmeter-tests</id>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
</executions>
<configuration>
<!-- This configuraition is to specify jmeter script, number -->
<testFilesIncluded>
<jMeterTestFile>${JmeterTestFile}.jmx</jMeterTestFile>
</testFilesIncluded>
<testResultsTimestamp>false</testResultsTimestamp>
<propertiesUser>
<Threadcount>${Threadcount}</Threadcount>
<Loopcount>${Loopcount}</Loopcount>
<Rampup>${RampUp}</Rampup>
</propertiesUser>
<testPlanLibraries>
<artifact>org.apache.activemq:activemq-spring:5.15.2</artifact>
<artifact>org.apache.activemq:activemq-client:5.15.2</artifact>
<artifact>org.apache.activemq:activemq-broker:5.15.2</artifact>
</testPlanLibraries>
<excludedArtifacts>
<exclusion>commons-pool2:commons-pool2</exclusion>
<exclusion>commons-math3:commons-math3</exclusion>
<exclusion>org.slf4j:slf4j-nop</exclusion>
<exclusion>logkit:logkit</exclusion>
<exclusion>avalon-logkit:avalon-logkit</exclusion>
<exclusion>jdom:jdom</exclusion>
<exclusion>log4j:log4j</exclusion>
<exclusion>commons-logging:commons-logging</exclusion>
<exclusion>excalibur-logger:excalibur-logger</exclusion>
</excludedArtifacts>
<jmeterExtensions>
<artifact>kg.apc:jmeter-plugins-casutg:2.4</artifact>
</jmeterExtensions>
<downloadExtensionDependencies>false</downloadExtensionDependencies>
<junitLibraries>
<artifact>com.lazerycode.junit:junit-test:1.0.0</artifact>
</junitLibraries>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<executions>
<execution>
<id>default-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<JmeterTestFile>test</JmeterTestFile>
<Threadcount>10</Threadcount>
<Loopcount>5</Loopcount>
<RampUp>1</RampUp>
</properties>
</project>
Upvotes: 1
Reputation: 58772
You are sending JMeter properties -DRampUp=2 -DLoopcount=1 -DThreadcount=10
to your jmx file,
So you must use them in your Thread Group:
Upvotes: 1