Skip to content

Remote Server Configuration

Ardesco edited this page Mar 12, 2013 · 9 revisions

#Remote Start And Stop Of Servers Via <remoteConfig>

Setting the <startServersBeforeTests> option will result in a --runremote command being send to JMeter which will start up any remote servers you have defined in your jmeter.properties when your first test starts.

Setting the <stopServersAfterTests> option will result in a --remoteexit command being send to JMeter which will shut down all remote servers defined in jmeter.properties after your last test has been run.

<startServersBeforeTests> and <stopServersAfterTests> can be used independantly so that it is possible to use another process to start and stop servers if required.

+---+
<project>
	[...]
	<build>
		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>${project.groupId}</groupId>
					<artifactId>${project.artifactId}</artifactId>
					<version>${project.version}</version>
					<executions>
						<execution>
							<id>jmeter-tests</id>
							<phase>verify</phase>
							<goals>
								<goal>jmeter</goal>
							</goals>
						</execution>
					</executions>
					<configuration>
						<remoteConfiguration>
							<startServersBeforeTests>true</startServersBeforeTests>
							<stopServersAfterTests>true</stopServersAfterTests>
						</remoteConfiguration>
					</configuration>
				</plugin>
			</plugins>
		</pluginManagement>
	</build>
	[...]
</project>
+---+

You can configure the plugin to perform a remote start and stop for each individual test by setting the <startAndStopServersForEachTest> variable to true. If you set this along with <startServersBeforeTests> and <stopServersAfterTests> the <startServersBeforeTests> and <stopServersAfterTests> settings will be ignored.

+---+
<project>
	[...]
	<build>
		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>${project.groupId}</groupId>
					<artifactId>${project.artifactId}</artifactId>
					<version>${project.version}</version>
					<executions>
						<execution>
							<id>jmeter-tests</id>
							<phase>verify</phase>
							<goals>
								<goal>jmeter</goal>
							</goals>
						</execution>
					</executions>
					<configuration>
						<remoteConfiguration>
							<startAndStopServersForEachTest>false</startAndStopServersForEachTest>
						</remoteConfiguration>
					</configuration>
				</plugin>
			</plugins>
		</pluginManagement>
	</build>
	[...]
</project>
+---+

Instead of starting all remote servers, you can specify which ones to start by using the <serverList> option, this will accept a comma separated list of servers for JMeter to start (these must be defined in your jmeter.properties).

+---+
<project>
	[...]
	<build>
		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>${project.groupId}</groupId>
					<artifactId>${project.artifactId}</artifactId>
					<version>${project.version}</version>
					<executions>
						<execution>
							<id>jmeter-tests</id>
							<phase>verify</phase>
							<goals>
								<goal>jmeter</goal>
							</goals>
						</execution>
					</executions>
					<configuration>
						<remoteConfiguration>
                            <startServersBeforeTests>true</startServersBeforeTests>
							<serverList>server1,server2</serverList>
							<stopServersAfterTests>true</stopServersAfterTests>
						</remoteConfiguration>
					</configuration>
				</plugin>
			</plugins>
		</pluginManagement>
	</build>
	[...]
</project>
+---+