{"id":1816,"date":"2014-11-28T11:17:52","date_gmt":"2014-11-28T11:17:52","guid":{"rendered":"http:\/\/blog.davidkeen.com\/?p=1816"},"modified":"2025-10-23T10:23:45","modified_gmt":"2025-10-22T23:53:45","slug":"run-multiple-gatling-simulations-with-maven","status":"publish","type":"post","link":"https:\/\/davidkeen.com\/blog\/2014\/11\/run-multiple-gatling-simulations-with-maven\/","title":{"rendered":"Run multiple Gatling simulations with Maven"},"content":{"rendered":"<p><a href=\"http:\/\/gatling.io\/\">Gatling<\/a> is nice load testing framework that uses Scala, Akka and Netty. It&#8217;s so much better than JMeter. It&#8217;s pretty easy to get started with scenarios written in a nice Scala DSL and it produces useful reports too. It also has a Maven plugin so you can incorporate continuous performance testing in your builds.<\/p>\n<p>The trouble is if you list multiple scenarios in a simulation they will all run concurrently which is probably not what you want. You need to split your tests into separate Simulation classes and run them sequentially. The <a href=\"http:\/\/gatling.io\/docs\/2.0.3\/extensions\/maven_plugin.html\">plugin documentation<\/a> briefly describes a way of doing this using executions but the example is a little light.<\/p>\n<p>Here&#8217;s a Maven profile that when activated will run your simulations sequentially. Execute the tests with <code>mvn test -Pperformance<\/code>.<\/p>\n<p><script src=\"https:\/\/gist.github.com\/davidkeen\/5ecac586cb46c3519808.js\"><\/script><\/p>\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>&lt;profiles>\n    &lt;profile>\n        &lt;id>performance&lt;\/id>\n        &lt;build>\n            &lt;plugins>\n                &lt;plugin>\n                    &lt;groupId>io.gatling&lt;\/groupId>\n                    &lt;artifactId>gatling-maven-plugin&lt;\/artifactId>\n                    &lt;version>2.0.0-RC4&lt;\/version>\n                    &lt;configuration>\n                        &lt;dataFolder>src\/test\/resources\/data&lt;\/dataFolder>\n                        &lt;resultsFolder>target\/gatling\/results&lt;\/resultsFolder>\n                        &lt;requestBodiesFolder>src\/test\/resources\/request-bodies&lt;\/requestBodiesFolder>\n                        &lt;simulationsFolder>src\/test\/scala&lt;\/simulationsFolder>\n                    &lt;\/configuration>\n                    &lt;executions>\n                        &lt;execution>\n                            &lt;id>test1&lt;\/id>\n                            &lt;phase>test&lt;\/phase>\n                            &lt;goals>\n                                &lt;goal>execute&lt;\/goal>\n                            &lt;\/goals>\n                            &lt;configuration>\n                                &lt;simulationClass>com.example.SimulationOne&lt;\/simulationClass>\n                            &lt;\/configuration>\n                        &lt;\/execution>\n                        &lt;execution>\n                            &lt;id>test2&lt;\/id>\n                            &lt;phase>test&lt;\/phase>\n                            &lt;goals>\n                                &lt;goal>execute&lt;\/goal>\n                            &lt;\/goals>\n                            &lt;configuration>\n                                &lt;simulationClass>com.example.SimulationTwo&lt;\/simulationClass>\n                            &lt;\/configuration>\n                        &lt;\/execution>\n                        &lt;execution>\n                            &lt;id>test3&lt;\/id>\n                            &lt;phase>test&lt;\/phase>\n                            &lt;goals>\n                                &lt;goal>execute&lt;\/goal>\n                            &lt;\/goals>\n                            &lt;configuration>\n                                &lt;simulationClass>com.example.SimulationThree&lt;\/simulationClass>\n                            &lt;\/configuration>\n                        &lt;\/execution>\n                    &lt;\/executions>\n                &lt;\/plugin>\n            &lt;\/plugins>\n        &lt;\/build>\n    &lt;\/profile>\n&lt;\/profiles><\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #81A1C1\">&lt;profiles&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">&lt;profile&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #81A1C1\">&lt;id&gt;<\/span><span style=\"color: #D8DEE9FF\">performance<\/span><span style=\"color: #81A1C1\">&lt;\/id&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #81A1C1\">&lt;build&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">            <\/span><span style=\"color: #81A1C1\">&lt;plugins&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                <\/span><span style=\"color: #81A1C1\">&lt;plugin&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                    <\/span><span style=\"color: #81A1C1\">&lt;groupId&gt;<\/span><span style=\"color: #D8DEE9FF\">io.gatling<\/span><span style=\"color: #81A1C1\">&lt;\/groupId&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                    <\/span><span style=\"color: #81A1C1\">&lt;artifactId&gt;<\/span><span style=\"color: #D8DEE9FF\">gatling-maven-plugin<\/span><span style=\"color: #81A1C1\">&lt;\/artifactId&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                    <\/span><span style=\"color: #81A1C1\">&lt;version&gt;<\/span><span style=\"color: #D8DEE9FF\">2.0.0-RC4<\/span><span style=\"color: #81A1C1\">&lt;\/version&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                    <\/span><span style=\"color: #81A1C1\">&lt;configuration&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                        <\/span><span style=\"color: #81A1C1\">&lt;dataFolder&gt;<\/span><span style=\"color: #D8DEE9FF\">src\/test\/resources\/data<\/span><span style=\"color: #81A1C1\">&lt;\/dataFolder&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                        <\/span><span style=\"color: #81A1C1\">&lt;resultsFolder&gt;<\/span><span style=\"color: #D8DEE9FF\">target\/gatling\/results<\/span><span style=\"color: #81A1C1\">&lt;\/resultsFolder&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                        <\/span><span style=\"color: #81A1C1\">&lt;requestBodiesFolder&gt;<\/span><span style=\"color: #D8DEE9FF\">src\/test\/resources\/request-bodies<\/span><span style=\"color: #81A1C1\">&lt;\/requestBodiesFolder&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                        <\/span><span style=\"color: #81A1C1\">&lt;simulationsFolder&gt;<\/span><span style=\"color: #D8DEE9FF\">src\/test\/scala<\/span><span style=\"color: #81A1C1\">&lt;\/simulationsFolder&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                    <\/span><span style=\"color: #81A1C1\">&lt;\/configuration&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                    <\/span><span style=\"color: #81A1C1\">&lt;executions&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                        <\/span><span style=\"color: #81A1C1\">&lt;execution&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                            <\/span><span style=\"color: #81A1C1\">&lt;id&gt;<\/span><span style=\"color: #D8DEE9FF\">test1<\/span><span style=\"color: #81A1C1\">&lt;\/id&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                            <\/span><span style=\"color: #81A1C1\">&lt;phase&gt;<\/span><span style=\"color: #D8DEE9FF\">test<\/span><span style=\"color: #81A1C1\">&lt;\/phase&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                            <\/span><span style=\"color: #81A1C1\">&lt;goals&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                                <\/span><span style=\"color: #81A1C1\">&lt;goal&gt;<\/span><span style=\"color: #D8DEE9FF\">execute<\/span><span style=\"color: #81A1C1\">&lt;\/goal&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                            <\/span><span style=\"color: #81A1C1\">&lt;\/goals&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                            <\/span><span style=\"color: #81A1C1\">&lt;configuration&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                                <\/span><span style=\"color: #81A1C1\">&lt;simulationClass&gt;<\/span><span style=\"color: #D8DEE9FF\">com.example.SimulationOne<\/span><span style=\"color: #81A1C1\">&lt;\/simulationClass&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                            <\/span><span style=\"color: #81A1C1\">&lt;\/configuration&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                        <\/span><span style=\"color: #81A1C1\">&lt;\/execution&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                        <\/span><span style=\"color: #81A1C1\">&lt;execution&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                            <\/span><span style=\"color: #81A1C1\">&lt;id&gt;<\/span><span style=\"color: #D8DEE9FF\">test2<\/span><span style=\"color: #81A1C1\">&lt;\/id&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                            <\/span><span style=\"color: #81A1C1\">&lt;phase&gt;<\/span><span style=\"color: #D8DEE9FF\">test<\/span><span style=\"color: #81A1C1\">&lt;\/phase&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                            <\/span><span style=\"color: #81A1C1\">&lt;goals&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                                <\/span><span style=\"color: #81A1C1\">&lt;goal&gt;<\/span><span style=\"color: #D8DEE9FF\">execute<\/span><span style=\"color: #81A1C1\">&lt;\/goal&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                            <\/span><span style=\"color: #81A1C1\">&lt;\/goals&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                            <\/span><span style=\"color: #81A1C1\">&lt;configuration&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                                <\/span><span style=\"color: #81A1C1\">&lt;simulationClass&gt;<\/span><span style=\"color: #D8DEE9FF\">com.example.SimulationTwo<\/span><span style=\"color: #81A1C1\">&lt;\/simulationClass&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                            <\/span><span style=\"color: #81A1C1\">&lt;\/configuration&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                        <\/span><span style=\"color: #81A1C1\">&lt;\/execution&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                        <\/span><span style=\"color: #81A1C1\">&lt;execution&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                            <\/span><span style=\"color: #81A1C1\">&lt;id&gt;<\/span><span style=\"color: #D8DEE9FF\">test3<\/span><span style=\"color: #81A1C1\">&lt;\/id&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                            <\/span><span style=\"color: #81A1C1\">&lt;phase&gt;<\/span><span style=\"color: #D8DEE9FF\">test<\/span><span style=\"color: #81A1C1\">&lt;\/phase&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                            <\/span><span style=\"color: #81A1C1\">&lt;goals&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                                <\/span><span style=\"color: #81A1C1\">&lt;goal&gt;<\/span><span style=\"color: #D8DEE9FF\">execute<\/span><span style=\"color: #81A1C1\">&lt;\/goal&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                            <\/span><span style=\"color: #81A1C1\">&lt;\/goals&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                            <\/span><span style=\"color: #81A1C1\">&lt;configuration&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                                <\/span><span style=\"color: #81A1C1\">&lt;simulationClass&gt;<\/span><span style=\"color: #D8DEE9FF\">com.example.SimulationThree<\/span><span style=\"color: #81A1C1\">&lt;\/simulationClass&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                            <\/span><span style=\"color: #81A1C1\">&lt;\/configuration&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                        <\/span><span style=\"color: #81A1C1\">&lt;\/execution&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                    <\/span><span style=\"color: #81A1C1\">&lt;\/executions&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                <\/span><span style=\"color: #81A1C1\">&lt;\/plugin&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">            <\/span><span style=\"color: #81A1C1\">&lt;\/plugins&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #81A1C1\">&lt;\/build&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">&lt;\/profile&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #81A1C1\">&lt;\/profiles&gt;<\/span><\/span><\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Gatling is nice load testing framework that uses Scala, Akka and Netty. It&#8217;s so much better than JMeter. It&#8217;s pretty easy to get started with scenarios written in a nice Scala DSL and it produces useful reports too. It also has a Maven plugin so you can incorporate continuous performance testing in your builds. The [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2641,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[25],"tags":[],"class_list":["post-1816","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dev"],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/davidkeen.com\/blog\/wp-content\/uploads\/2014\/11\/pexels-photo-185719.jpeg?fit=1280%2C853&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/davidkeen.com\/blog\/wp-json\/wp\/v2\/posts\/1816","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/davidkeen.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/davidkeen.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/davidkeen.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/davidkeen.com\/blog\/wp-json\/wp\/v2\/comments?post=1816"}],"version-history":[{"count":8,"href":"https:\/\/davidkeen.com\/blog\/wp-json\/wp\/v2\/posts\/1816\/revisions"}],"predecessor-version":[{"id":2853,"href":"https:\/\/davidkeen.com\/blog\/wp-json\/wp\/v2\/posts\/1816\/revisions\/2853"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/davidkeen.com\/blog\/wp-json\/wp\/v2\/media\/2641"}],"wp:attachment":[{"href":"https:\/\/davidkeen.com\/blog\/wp-json\/wp\/v2\/media?parent=1816"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/davidkeen.com\/blog\/wp-json\/wp\/v2\/categories?post=1816"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/davidkeen.com\/blog\/wp-json\/wp\/v2\/tags?post=1816"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}