The blog post "Running JUnitSampler with Maven" describes already a workaround, but there is an issue if you are working on Windows.
Maven JMeter plugin
The Maven JMeter plugin is under development and the only available source is from the JMeterMavenPlugin Wiki Site. But do not download the code from there, the above mentioned blog has provides already a patched version.Maven Dependency Plugin
The blog post shows a code snippet using the Maven Dependency Plugin. The plugin is used to dump the classpath to a file, which is read by an extended JMeter plugin to create the classpath necessary to execute the JUnit tests. The plugin is referenced with version 2.0-alpha-4.In the meanwhile the plugin version 2.0 was released. There is a significant change from version 2.0-alpha-4. The alpha version used the colon ':' hard coded to separate path entries, but this is a serious problem for Windows systems, since you have the colon as the drive locator. This was fixed in the final version, which now uses the File.separator char. Further you could now explicitly set the separator using the pathSeparator property, which was not possible in 2.0-alpha-4.
The plugin configuration therefore must be:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.0</version>
<executions>
<execution>
<id>build-classpath</id>
<phase>test-compile</phase>
<goals>
<goal>build-classpath</goal>
</goals>
<configuration>
<cpFile>target/classpath</cpFile>
<includeScope>test</includeScope>
</configuration>
</execution>
</executions>
</plugin>
JUnitSampler limitations
The JUnitSampler implies that the test classes are derived from class TestCase. Therefore it does not work for:- Test Suites
- JUnit 4 style test classes
If setUp() and tearDown() methods should be called they must be public, otherwise they cannot be invoked.
Repository Configuration
Sometime I wonder why there are central repository sites like ibiblio if you can't find some fundamental jars there. I think I come to this back later in a separate blog post. Same problem for the JMeter jars. Of course I can download the jars and install them to my local repository, but I wanted to get the JMeter jar from a Maven repository. The only location I found was the repository at thinkpond.orgSo instead of installing JMeter manually you can configure the repository:
<repositories>
<repository>
<id>thinkpond.org</id>
<name>thinkpond.org Repository</name>
<url>http://bin.thinkpond.org/repo</url>
</repository>
</repositories>
Conclusion
It is a bit tricky to integrate JMeter in Maven. But with the tips found in the mentioned blog it is possible to manage the task. Building the JMeter plugin from source is not what I wanted to do to get things running. Also it does not seem that the mentioned workaround will go into the development of the JMeter plugin.Executing JUnit tests using JMeter's JUnitSampler has some limitations that are annoying for JUnit 4 users. Hopefully there will come a JUnit4Sampler in future.
If you plan to use this framework stack be aware that you will have to keep a patched version of the JMeter plugin in your development environment until there will be an official solution. If you can live with the mentioned workarounds and limitations this combination can be a comfortable way to execute performance tests using Maven. Especially setting up JMeter's classpath can be tedious without Maven integration.
Appendix
Resources
- Running JUnitSampler with Maven
- Maven JMeter plugin and report generation (the last steps to get it working)
- Maven Dependency Plugin - Homepage
- Maven Dependency Plugin - dependency:build-classpath
- Thinkpond.org Maven2 repository
Posted by dfvbdfb on August 21, 2009 at 03:02 AM GMT #
Posted by metin2 yang on November 23, 2009 at 09:14 AM GMT #
Posted by rom on December 20, 2009 at 02:34 AM GMT #
Posted by rom on December 20, 2009 at 02:34 AM GMT #
Posted by cheap ugg boots on December 25, 2009 at 02:58 AM GMT #
Posted by ugg boots on December 25, 2009 at 02:59 AM GMT #
Posted by ugg boots on January 21, 2010 at 07:04 AM GMT #
Posted by knight on January 22, 2010 at 07:01 AM GMT #
Posted by jordan shoes on March 16, 2010 at 08:18 AM GMT #
Posted by cheap nfl jerseys on April 15, 2010 at 07:42 AM GMT #
Posted by louboutin shoes on April 15, 2010 at 01:42 PM GMT #
Posted by cheap nfl jerseys on April 23, 2010 at 07:34 AM GMT #
Posted by mbt on April 23, 2010 at 12:04 PM GMT #
Posted by Jake on May 10, 2010 at 12:07 PM GMT #
Posted by anti shoes on May 12, 2010 at 11:32 AM GMT #
Posted by ???? on June 22, 2010 at 12:21 PM GMT #
Posted by xiaoiq on July 26, 2010 at 10:54 PM GMT #
Posted by air max nike shoes on August 16, 2010 at 01:25 PM GMT #
Posted by nike lebron vii shoes on August 16, 2010 at 01:27 PM GMT #
Posted by swiss replica watch on August 17, 2010 at 02:44 AM GMT #
Posted by p90x on August 29, 2010 at 11:09 PM GMT #
Posted by http://www.itunes-gift-cards.net on August 30, 2010 at 06:25 AM GMT #
Posted by http://www.agoodeman.com/ on August 30, 2010 at 06:26 AM GMT #
Posted by http://www.aurautah.com on August 30, 2010 at 06:28 AM GMT #