Gradle plugin configuration

There are some Gradle plugins available that provide support for running tests during the build of a project. However, we can also define a simple Gradle task that just runs tests by using the io.gatling.app.Gatling class:

task loadTest(type: JavaExec) {
dependsOn testClasses
description = "This Account Microservice Gatling Performance test
for a Microservice."
group = "Load Test"
classpath = sourceSets.test.runtimeClasspath
jvmArgs = [
"-Dgatling.core.directory.binaries=${sourceSets.test.output.classesDir.toString()}"
]
main = "io.gatling.app.Gatling"
args = [
"--simulation", "dineshonjava.AccountGatlingSimulation",
"--results-folder", "${buildDir}/gatling-results",
"--binaries-folder",
sourceSets.test.output.classesDir.toString(),
"--bodies-folder",
sourceSets.test.resources.srcDirs.toList().first().toString() +
"/gatling/bodies",
]
}

The preceding code must be added to a build.gradle file. This is the default way of creating custom tasks for Gradle. It is a JavaExec type task, with test class dependencies. This means that it has nothing to do with the main classes.

In the preceding configuration, the most important thing is the args attribute values, where we let Gatling know about the simulation to be executed, the result-folder to be used to store reports, and the bodies-folder to be used to get body files. These body files are for requests that require a body.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.58.199