4

こんにちは私はlazerycodeのjmeter-maven-pluginを使用してJMeterの負荷分散テストを自動化しようとしています。私のJMeterテストでは、maven-jar-pluginを使用してtest-jarにパックした既成のjunitクラスファイルを使用します。しかし、jarファイルがローカルのMavenリポジトリにインストールされる前に、Mavenはjmeterテストを開始します。jmeterプラグインの依存関係として使用できるようにtest-jarをインストールする方法はありますか?以下に私のjmeterプラグインの設定を示します。

<plugin>
            <groupId>com.lazerycode.jmeter</groupId>
            <artifactId>jmeter-maven-plugin</artifactId>
            <version>1.4.1</version>
            <executions>
                <execution>
                    <id>jmeter-test</id>
                    <phase>integration-test</phase>
                    <goals>
                        <goal>jmeter</goal>
                    </goals>
                </execution>
            </executions>
            <dependencies>
                <dependency>
                    <groupId>groupID</groupId>
                    <artifactId>artifactID</artifactId>
                    <version>${project-version}</version>
                    <type>test-jar</type>
                </dependency>
            </dependencies>
            <configuration>
                <propertiesUser>
                    <current.protocol>http</current.protocol>
                    <current.dns>localhost</current.dns>
                    <current.port>8088</current.port>
                </propertiesUser>
                <testFilesDirectory>${basedir}/src/jmeter/tests/</testFilesDirectory>
                <ignoreResultErrors>true</ignoreResultErrors>
                <ignoreResultFailures>true</ignoreResultFailures>
                <useOldTestEndDetection>true</useOldTestEndDetection>
            </configuration>
        </plugin> 

どうも

4

2 に答える 2

3

テストjarを別のモジュールに配置し、jmeterプラグインを使用してプロジェクトをそのモジュールに依存させます。その後、テストをインストールして、1回のMaven呼び出しでjmeterで実行できるようになります。

于 2012-08-13T22:13:26.270 に答える
1

アクティベーションプロファイルを使用してこの問題を解決しました:-

<profiles>
        <profile>
                <id>ptest</id>
                <activation>
                    <property>
                        <name>ptest</name>
                    </property>
                </activation>

                <build>

                    <resources>
                        <resource>
                            <directory>src/jmeter</directory>
                        </resource>
                    </resources>

                    <plugins>
                        <plugin>
                            <groupId>com.lazerycode.jmeter</groupId>
                            <artifactId>jmeter-maven-plugin</artifactId>
                            <version>1.4.1</version>
                            <executions>
                                <execution>
                                    <id>jmeter-tests</id>
                                    <phase>verify</phase>
                                    <goals>
                                        <goal>jmeter</goal>
                                    </goals>
                                </execution>
                            </executions>
                            <configuration>
                                <useOldTestEndDetection>true</useOldTestEndDetection>
                            </configuration>
                        </plugin>
                    </plugins>
                </build>
            </profile>
    </profiles>

このアプローチを使用すると、プロファイルを使用せずに一度インストールしてから、プロファイルをオンにして実行することができます。

于 2012-08-13T10:33:24.863 に答える