<dependencies>
<dependency>
<groupId>io.gatling.highcharts</groupId>
<artifactId>gatling-charts-highcharts</artifactId>
<version>MANUALLY_REPLACE_WITH_LATEST_VERSION</version>
<scope>test</scope>
</dependency>
</dependencies>
<plugin>
<groupId>io.gatling</groupId>
<artifactId>gatling-maven-plugin</artifactId>
<version>MANUALLY_REPLACE_WITH_LATEST_VERSION</version>
</plugin>
您可以在Gatling的Github组织中找到gatling-sbt-plugin-demo的示例项目。
您还可以使用来引导项目。
Usage您可以直接启动gatling-maven-plugin,其test目标是:
mvn gatling:test
它默认绑定到integration-test阶段。
Configuration下面的例子显示了默认值(所以不要指定你没有覆盖的选项!!!):
<configuration>
<simulationClass>foo.Bar</simulationClass> <!-- the name of the single Simulation class to run -->
<runMultipleSimulations>false</runMultipleSimulations> <!-- if the plugin should run multiple simulations sequentially -->
<includes> <!-- include filters, see dedicated section below -->
<include></include>
</includes>
<excludes> <!-- exclude filters, see dedicated section below -->
<exclude></exclude>
</excludes>
<noReports>false</noReports> <!-- to disable generating HTML reports -->
<reportsOnly></reportsOnly> <!-- to only trigger generating HTML reports from the log file contained in folder parameter -->
<runDescription>This-is-the-run-description</runDescription> <!-- short text that will be displayed in the HTML reports -->
<skip>false</skip> <!-- skip executing this plugin -->
<failOnError>true</failOnError> <!-- report failure in case of assertion failure, typically to fail CI pipeline -->
<continueOnAssertionFailure>false</continueOnAssertionFailure> <!-- keep on executing multiple simulations even if one fails -->
<useOldJenkinsJUnitSupport>false</useOldJenkinsJUnitSupport> <!-- report results to Jenkins JUnit support (workaround until we manage to get Gatling support into Jenkins) -->
<jvmArgs>
<jvmArg>-DmyExtraParam=foo</jvmArg> <!-- pass extra parameters to the Gatling JVM -->
</jvmArgs>
<overrideJvmArgs>false</overrideJvmArgs> <!-- if above option should override the defaults instead of replacing them -->
<propagateSystemProperties>true</propagateSystemProperties> <!-- if System properties from the maven JVM should be propagated to the Gatling forked one -->
<compilerJvmArgs>
<compilerJvmArg>-DmyExtraParam=foo</compilerJvmArg> <!-- pass extra parameters to the Compiler JVM -->
</compilerJvmArgs>
<overrideCompilerJvmArgs>false</overrideCompilerJvmArgs> <!-- if above option should override the defaults instead of replacing them -->
<extraScalacOptions> <!-- extra options to be passed to scalac -->
<extraScalacOption></extraScalacOption>
</extraScalacOptions>
<disableCompiler>false</disableCompiler> <!-- if compiler should be disabled, typically because another plugin has already compiled sources -->
<simulationsFolder>${project.basedir}/src/test/scala</simulationsFolder> <!-- where the simulations to be compiled are located -->
<resourcesFolder>${project.basedir}/src/test/resources</resourcesFolder> <!-- where the test resources are located -->
<resultsFolder>${project.basedir}/target/gatling</resultsFolder> <!-- where the simulation log and the HTML reports will be generated -->
</configuration>