This is an automated email from the ASF dual-hosted git repository. bdelacretaz pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git
commit 1451d2c02f5f528dfb21468b72e98aab4962813c Author: Bertrand Delacretaz <[email protected]> AuthorDate: Tue Sep 4 15:02:47 2018 +0200 Add Gatling performance tests --- karate-http-testing/pom.xml | 18 ++++++++++++++ .../test/scala/sling/PostServletSimulation.scala | 29 ++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/karate-http-testing/pom.xml b/karate-http-testing/pom.xml index 8c17fba..6569dd8 100644 --- a/karate-http-testing/pom.xml +++ b/karate-http-testing/pom.xml @@ -12,6 +12,7 @@ <java.version>1.8</java.version> <maven.compiler.version>3.6.0</maven.compiler.version> <karate.version>0.8.0</karate.version> + <gatling.plugin.version>2.2.4</gatling.plugin.version> </properties> <dependencies> @@ -27,6 +28,12 @@ <version>${karate.version}</version> <scope>test</scope> </dependency> + <dependency> + <groupId>com.intuit.karate</groupId> + <artifactId>karate-gatling</artifactId> + <version>${karate.version}</version> + <scope>test</scope> + </dependency> </dependencies> <build> @@ -50,6 +57,17 @@ <compilerArgument>-Werror</compilerArgument> </configuration> </plugin> + <plugin> + <groupId>io.gatling</groupId> + <artifactId>gatling-maven-plugin</artifactId> + <version>${gatling.plugin.version}</version> + <configuration> + <simulationsFolder>src/test/scala</simulationsFolder> + <includes> + <include>sling.PostServletSimulation</include> + </includes> + </configuration> + </plugin> </plugins> </build> diff --git a/karate-http-testing/src/test/scala/sling/PostServletSimulation.scala b/karate-http-testing/src/test/scala/sling/PostServletSimulation.scala new file mode 100644 index 0000000..adcc5fa --- /dev/null +++ b/karate-http-testing/src/test/scala/sling/PostServletSimulation.scala @@ -0,0 +1,29 @@ +package sling + +import com.intuit.karate.gatling.PreDef.{pauseFor, _} +import io.gatling.core.Predef._ + +import scala.concurrent.duration._ + +/* Example Gatling performance tests which reuse Karate scenarios. + * + * Run with + * mvn clean test-compile gatling:test + * + * And see the output for the Gatling report filename. + */ +class PostServletSimulation extends Simulation { + + val protocol = karateProtocol( + "/createContentTest/*" -> pauseFor("post" -> 2, "get" -> 5, "delete" -> 2), + "/importContentTest/*" -> pauseFor("post" -> 7, "get" -> 15, "delete" -> 50), + ) + + val createContent = scenario("create").exec(karateFeature("classpath:sling/postservlet/createcontent/createContent.feature")) + val importContent = scenario("import").exec(karateFeature("classpath:sling/postservlet/createcontent/importContent.feature")) + + setUp( + createContent.inject(rampUsers(75) over (5 seconds)).protocols(protocol), + importContent.inject(rampUsers(125) over (3 seconds)).protocols(protocol) + ) +} \ No newline at end of file
