has anyone tried to fail the running Jenkins Job when Gatling asserts are not met or if the requests fail?
For instance:
Does anyone have an idea how this can be achieved with the existing Maven / Jenkins plugins for Gatling.
my maven Plugin settings are:
<plugin>
<groupId>io.gatling</groupId>
<artifactId>gatling-maven-plugin</artifactId>
<version>${gatling.version}</version>
<configuration>
<failOnError>true</failOnError>
<simulationsFolder>src/test/scala</simulationsFolder>
<runMultipleSimulations>true</runMultipleSimulations>
<configFolder>src/main/resources</configFolder>
</configuration>
<executions>
<execution>
<id>GoOrBust</id>
<phase>test</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<simulationClass>mine.OnePunch</simulationClass>
<failOnError>true</failOnError>
</configuration>
</execution>
</executions>
</plugin>
the <failOnError>true</failOnError>
will only influence the report generation but not the Jenkins Job (obviously).
I would prefer not to explicitly throw exceptions from inside the tests by doing custom exception monitoring / handling.
Gatling-specific solution: you need to define a global assertion in your Gatling script like:
setUp(scn.inject( ... ))
.protocols(httpProtocol)
.assertions(
global.successfulRequests.percent.greaterThan(99)
)
Alternative. You can consider running your Gatling script using Taurus tool as a wrapper. It can consume existing Gatling tests and apply flexible Pass/Fail Criteria to them. In case of failure trigger Taurus will return non-zero exit code hence Jenkins job will fail.
If Dmitri's 1 failed for you, see https://groups.google.com/forum/#!topic/gatling/OjsdqXej2_s
setUp(scn.inject( ... )
.protocols(httpProtocol))
.assertions(
global.successfulRequests.percent.greaterThan(99)
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With