Friday, August 2, 2013

Maven Ant Plugin in JMeter



I have post 2 essay in my blog:
[JMeter Ant build]: http://howtesting.blogspot.com/2013/07/jmeter-ant-build.html
[JMeter Maven Tutorial]: http://howtesting.blogspot.com/2013/07/jmeter-maven-tutorial-version-181.html
Because Document of JMeter is very poor, If you like to make pom.xml, you should read source code of JMeter to understand better to create script.
So I like to use External Ant Script from a Maven Build for a Project.

Executing an External Ant Script from a Maven Build

<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>org.apache.maven.plugins</groupId>
  <artifactId>maven-antrun-plugin</artifactId>
  <packaging>pom</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>ant-script-ex</name>
  <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <skipTests>false</skipTests>
</properties>
  <build>
    <plugins>
      <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <version>1.7</version>
        <executions>
          <execution>
                                    <id>id.validate</id>
                                    <phase>validate</phase>
       
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>                                 
              <tasks>
             <exec
                  dir="D:/apache-jmeter/jmeter/extras"
                  executable="C:/apache-ant-1.7.1/bin/ant.bat"
                  failonerror="true">
                  <arg line="-Dtest=script run report" />
                                                </exec>
                                   
              </tasks>
                                     
                         <dependencies>
                                                <dependency>
                                                            <groupId>ant-contrib</groupId>
                                                             <artifactId>ant-contrib</artifactId>
                                                             <version>1.0b3</version>
                                                             <exclusions>
                                                               <exclusion>
                                                                         <groupId>ant</groupId>
                                                                         <artifactId>ant</artifactId>
                                                               </exclusion>
                                                             </exclusions>
                                       </dependency>
                                      
                                       <dependency>
                                                            <groupId>org.apache.ant</groupId>
                                                            <artifactId>ant-nodeps</artifactId>
                                                            <version>1.8.1</version>
                                                </dependency>
                                   
                                                <dependency>
                                                            <groupId>org.apache.maven</groupId>
                                                            <artifactId>maven-ant-tasks</artifactId>
                                                            <version>2.1.3</version>
                                                </dependency>
                                               
                                                <dependency>
                                                            <groupId>org.apache.maven.plugins</groupId>
                                                            <artifactId>maven-antrun-plugin</artifactId>
                                                            <version>1.7</version>
                                                </dependency>
                                               
                                    </dependencies>
            </configuration>
                                   
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>


Command to run pom.xml
Mvn validate

HoaLe



2 comments:

  1. http://blazemeter.com/blog/how-run-load-test-50k-concurrent-users?utm_source=hs_email&utm_medium=email&utm_content=12471254&_hsenc=p2ANqtz-8SbaaaaTEUwXX5afr7UFqBvAVVUELUxlxsOf9OW3VG2mKtRa856_ksjzcGPxvMA-8mb_Wui1woCDGgRAihDqb1QOhtqQ&_hsmi=12471254

    ReplyDelete
  2. http://blazemeter.com/blog/how-performance-test-upload-and-download-scenarios-apache-jmeter

    ReplyDelete