mvn verify does not run Gatling

I am following the directions in https://gatling.io/docs/3.0/extensions/maven_plugin/

When I configure

`

<plugin>
    <!--
       https://gatling.io/docs/2.2/extensions/maven_plugin/
       https://github.com/gatling/gatling-maven-plugin-demo
    -->
    <groupId>io.gatling</groupId>
    <artifactId>gatling-maven-plugin</artifactId>
    <version>3.0.1</version>
</plugin>
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-failsafe-plugin</artifactId>
    <version>3.0.0-M1</version>
    <executions>
        <execution>
            <goals>
                <goal>integration-test</goal>
                <goal>verify</goal>
            </goals>
        </execution>
    </executions>
</plugin>

`

and try

`
mvn verify

`

I get

`
[INFO]
[INFO] — maven-jar-plugin:2.4:jar (default-jar) @ service —
[INFO]
[INFO] — maven-failsafe-plugin:3.0.0-M1:integration-test (default) @ service —
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] — maven-failsafe-plugin:3.0.0-M1:verify (default) @ service —
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.724 s
[INFO] Finished at: 2018-12-07T11:57:11-08:00
[INFO] ------------------------------------------------------------------------

`

In short, while it goes through the integration-test phase, it does not run my Gatling tests. If I try

mvn gatling:integration-test

I get

`
Erics-MacBook-Pro:leaderboard eric$ mvn gatling:integration-test
[INFO] Scanning for projects…
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.329 s
[INFO] Finished at: 2018-12-07T12:01:44-08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Could not find goal ‘integration-test’ in plugin io.gatling:gatling-maven-plugin:3.0.1 among available goals help, recorder, test → [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoNotFoundException

`

Is it possible to get Gatling to run from mvn verify?

Hi,

There’s some misunderstanding on how maven-failsafe-plugin works.
maven-failsafe-plugin is actually a fork or maven-surefire-plugin (they share the same code base and live in the same repo).

So it only works with frameworks that surefire supports (JUnit, TestNG…), hence there’s no way it could work with Gatling.

What it actually does is have 2 different mojos:

  • one bound on integration-test phase that silently trigger the tests and buffer the results into a file
  • one bound on verify phase that reads the file and propagate possible errors

Such feature is not implemented in Gatling atm, but is perfectly doable.
Feel free to either reach out for us if you’re interested in contracting with us so we implement it, or contribute it otherwise.

Regards,

Thanks for the explanation. So, if I wanted to contribute to the documentation, to explain what you said, where would I do that. Is it in the Gatling github project, or somewhere else?

Cheers, Eric

Yes, the documentation sources are on Github: https://github.com/gatling/gatling/blob/master/src/sphinx/extensions/maven_plugin.rst

Contributions are very welcome!

Thanks. I created a pull request with my suggestions.

Cheers, Eric