nGrinder Maven工程使用

BitTigerio 2018-01-25

1:新建Maven groovy工程
2:SVN Checkout Maven工程
3:新建JUnit脚本,并运行,提示报错
java.lang.RuntimeException: Please add
-javaagent:/Users/xx/.m2/repository/net/sf/grinder/grinder-dcr-agent/3.9.1/grinder-dcr-agent-3.9.1.jar
in 'Run As JUnit' vm argument.
4:Edit Run Configuration
VM options添加

-ea -javaagent:/Users/xx/.m2/repository/net/sf/grinder/grinder-dcr-agent/3.9.1/grinder-dcr-agent-3.9.1.jar

5:Maven 工程目录结构
nGrinder Maven工程使用

6:修改pom.xml 文件

<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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>ngrinder</groupId>
    <artifactId>test</artifactId>
    <version>0.0.1</version>

    <properties>
        <ngrinder.version>3.4</ngrinder.version>
        <maven.compiler.source>1.7</maven.compiler.source>
        <maven.compiler.target>1.7</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <repositories>
        <repository>
            <id>ngrinder.maven.repo</id>
            <url>https://github.com/naver/ngrinder/raw/ngrinder.maven.repo/releases</url>
        </repository>
    </repositories>
    <dependencies>
        <dependency>
            <groupId>org.ngrinder</groupId>
            <artifactId>ngrinder-groovy</artifactId>
            <version>${ngrinder.version}</version>
            <scope>provided</scope>
        </dependency>

        <!-- 添加依赖 -->
        <!--
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.0.1</version>
        </dependency>
         -->
        <!-- 添加你的私有库依赖 -->
        <!--
        <dependency>
            <groupId>your_lib</groupId>
            <artifactId>your_lib</artifactId>
            <version>your_lib_version</version>
            <scope>system</scope>
            <systemPath>${project.basedir}/lib/hello.jar</systemPath>
        </dependency>
        -->
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-eclipse-plugin</artifactId>
                <version>2.9</version>
                <configuration>
                    <additionalProjectnatures>
                        <projectnature>
                            org.eclipse.jdt.groovy.core.groovyNature
                        </projectnature>
                        <projectnature>
                            org.eclipse.m2e.core.maven2Nature
                        </projectnature>
                    </additionalProjectnatures>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>