Skip to content

moritzzimmer/gradle-gatling-plugin

 
 

Repository files navigation

Gatling Plugin for Gradle

Gatling

Master branch Build Status

Installation

Follow the steps described at Gradle Plugin Portal page.

Java 8 Upgrade
  • Due to a bug Gatling 2.2.0 is supported only from gradle-gatling-plugin version 0.3.0

  • JDK 8 is required for Gatling 2.2.0, so this plugin is also require JDK8

For whatever reason you stuck with JDK 7, please keep using the 0.2.x series of this plugin.

Project Layout

Plugin supports two source files layouts for Gatling simulations and related data.

  • Standard Gradle/Maven layout

  • Gatling-like layout

There’s no need to explicitly setup any of those. Plugin auto-detects layout during examination of project’s folder structure.

Standard Gradle/Maven layout

Directory Meaning

src/gatling/scala

Simulation sources

src/gatling/resources/data

Feeder data

src/gatling/resources/bodies

Request bodies

src/gatling/resources/conf

Custom gatling configurations

Gatling-like layout

Directory Meaning

src/gatling/simulations

Simulation sources

src/gatling/data

Feeder data

src/gatling/bodies

Request bodies

src/gatling/conf

Custom gatling configurations

Plugin configuration

The plugin defines the following extension properties in the gatling closure

Property name Type Default value Description

toolVersion

String

'2.2.2'

Gatling version

logLevel

String

'WARN'

The default Gatling console log level if no logback.xml present in the configutation folder

jvmArgs

List<String>

['-server', '-XX:+UseThreadPriorities',
'-XX:ThreadPriorityPolicy=42',
'-Xms512M', '-Xmx512M', '-Xmn100M',
'-XX:+HeapDumpOnOutOfMemoryError',
'-XX:+AggressiveOpts',
'-XX:+OptimizeStringConcat',
'-XX:+UseFastAccessorMethods',
'-XX:+UseParNewGC',
'-XX:+UseConcMarkSweepGC',
'-XX:+CMSParallelRemarkEnabled',
'-Djava.net.preferIPv4Stack=true',
'-Djava.net.preferIPv6Addresses=false']

Additional arguments passed to JVM when executing Gatling simulations

simulations

Closure or Iterable<String>

{ include "**/*Simulation.scala" }

Simulations filter.
If closure then See Gradle docs for details, otherwise an Iterable of simulations fully qualified names.

Examples

gatling {
    toolVersion = '2.2.2'
    jvmArgs = [ '-server', '-Xms512M', '-Xmx512M' ]
    simulations = {
        include "**/folder1/*Simu.scala"    <1>
        include "**/folder2/*Simulation.scala"  <2>
    }
}
  1. all Scala files from folder1 ending with Simu.

  2. all Scala files from folder2 ending with Simulation.

Tasks

Plugin provides dedicated task GatlingRunTask that is responsible for execute gatling simulations. Customer may create instances of this task to execue particular simulations. Task extends Gradle’s JavaExec task.

Default tasks

Additionally plugin creates several default tasks

Task name Type Description

gatlingClasses

-

Compiles Gatling simulation and copies resources

gatlingRun

GatlingRunTask

Executes all Gatling simulations configured by extension

gatlingRun-SimulationFQN

GatlingRunTask

Executes single Gatling simulation,
SimulationFQN should be replaced by fully qualified simulation class name.

Examples

  1. Run all simulations

    $ gradle gatlingRun
  2. Run single simulation implemented in com.project.simu.MySimulation class

    $ gradle gatlingRun-com.project.simu.MySimulation

Dependency Management

This plugin defines two configurations gatlingCompile and gatlingRuntime. By default plugins adds gatling libraries and project’s classes and tests classes to gatlingCompile configurations Additional dependencies can be added by plugin’s users.

Examples

dependencies {
    gatlingCompile 'org.apache.commons:commons-lang3:3.4' (1)
    gatlingRuntime 'cglib:cglib-nodep:3.2.0' (2)
}
  1. adding commons-lang3 to compile classpath for Gatling simulations.

  2. adding cglib to runtime classpath for Gatling simulations.

About

Gatling Plugin for Gradle

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Groovy 68.3%
  • Scala 29.9%
  • Java 1.8%