2

特定のスレッド数で実行するように、jenkins で Jmeter スクリプトを構成したいと考えています。10 または 20 または 30 としましょう。私は Jenkins で maven を使用しています。どのようにしてスレッド値をパラメーターとして渡すことができるので、毎回 diff スレッドのジョブを実行できますか。mvn verify コマンドを使用して jmeter ファイルを実行しています。

<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>
    <build>
        <plugins>
            <plugin>
                <groupId>com.lazerycode.jmeter</groupId>
                <artifactId>jmeter-maven-plugin</artifactId>
                <version>1.10.1</version>
                <configuration>
                    <testResultsTimestamp>false</testResultsTimestamp>
                </configuration>
                <executions>
                    <execution>
                        <id>jmeter-tests</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>jmeter</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
             <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.17</version>
        <configuration>
            <argLine>-Xmx2048m</argLine>
        </configuration>
      </plugin>
        </plugins>
    </build>
</project> 
4

2 に答える 2

0

ウィキを見てください:

https://github.com/jmeter-maven-plugin/jmeter-maven-plugin/wiki/Modifying-Properties#6

具体的には:

+---+
<project>
    [...]
        <build>
            <plugins>
                <plugin>
                    <groupId>com.lazerycode.jmeter</groupId>
                    <artifactId>jmeter-maven-plugin</artifactId>
                    <version>1.10.1</version>
                    <executions>
                        <execution>
                            <id>jmeter-tests</id>
                            <phase>verify</phase>
                            <goals>
                                <goal>jmeter</goal>
                            </goals>
                            <configuration>
                                <propertiesGlobal>
                                    <threads>10</threads>
                                    <testIterations>5</testIterations>
                                </propertiesGlobal>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    [...]
</project>
+---+

コマンド ラインでこれらのプロパティを変更できるようにする場合は、次のように Maven プロパティを設定します。

+---+
<properties>
    <threads>10</threads>
    <testIterations>5</testIterations>
</properties>

<project>
    [...]
        <build>
            <plugins>
                <plugin>
                    <groupId>com.lazerycode.jmeter</groupId>
                    <artifactId>jmeter-maven-plugin</artifactId>
                    <version>1.10.1</version>
                    <executions>
                        <execution>
                            <id>jmeter-tests</id>
                            <phase>verify</phase>
                            <goals>
                                <goal>jmeter</goal>
                            </goals>
                            <configuration>
                                <propertiesGlobal>
                                    <threads>${threads}</threads>
                                    <testIterations>${testIterations}</testIterations>
                                </propertiesGlobal>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    [...]
</project>
+---+

次に、次のように指定できます。

mvn clean install -Dthreads=5 -DtestIterations=15
于 2015-09-28T10:37:01.903 に答える
0

jmeter-maven-plugin を使用して Maven 経由で JMeter テストを実行することは問題ありませんが、pom.xml はスレッド カウントなどのプロパティを定義する場所ではありません。探しているのは__propertyまたは__P JMeter 関数です。

于 2015-09-26T13:00:00.127 に答える