Skip to content

mahnkong/gradle-gatling-plugin

 
 

Repository files navigation

Gatling Plugin for Gradle

Gatling

Master branch Build Status

Installation

Add following to build.gradle

plugins {
  id "com.github.lkishalmi.gatling" version "0.3.0"
}
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

Tasks

Task name Description

gatlingClasses

Compiles Gatling simulation and copies resources

gatling

Executes all Gatling simulations

gatling-SimulationFQN

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

Examples
  1. Run all simulations

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

    $ gradle gatling-com.project.simu.MySimulation

Plugin configuration

The plugin defines the following extension properties in the gatling closure

Property name Type Default value Description

toolVersion

String

'2.2.0'

Gatling version

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

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

Simulations filter. See Gradle docs

Example
gatling {
    toolVersion = '2.2.0'
    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.

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.

Example
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 74.5%
  • Scala 25.5%