Added Gatling performance testing
This commit is contained in:
parent
328cd9bf24
commit
a676fffc4e
3
pom.xml
3
pom.xml
@ -132,6 +132,8 @@
|
||||
<commons-lang3.version>3.4</commons-lang3.version>
|
||||
<commons-logging.version>1.2</commons-logging.version>
|
||||
<coveralls-maven-plugin.version>4.0.0</coveralls-maven-plugin.version>
|
||||
<gatling.version>2.2.5</gatling.version>
|
||||
<gatling-plugin.version>2.2.4</gatling-plugin.version>
|
||||
<guava.version>18.0</guava.version>
|
||||
<h2.version>1.4.190</h2.version>
|
||||
<hsqldb.version>2.3.2</hsqldb.version>
|
||||
@ -155,6 +157,7 @@
|
||||
<maven-source-plugin.version>3.0.1</maven-source-plugin.version>
|
||||
<maven-surefire-plugin.version>2.19</maven-surefire-plugin.version>
|
||||
<nexus-staging-maven-plugin.version>1.6.6</nexus-staging-maven-plugin.version>
|
||||
<scala.version>2.11.7</scala.version>
|
||||
<sauce_junit.version>2.1.20</sauce_junit.version>
|
||||
<selenium-java.version>2.48.2</selenium-java.version>
|
||||
<slf4j-api.version>1.7.12</slf4j-api.version>
|
||||
|
@ -14,6 +14,29 @@
|
||||
</parent>
|
||||
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>performance</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>io.gatling</groupId>
|
||||
<artifactId>gatling-maven-plugin</artifactId>
|
||||
<version>${gatling-plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>execute</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
|
||||
</profiles>
|
||||
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
@ -129,6 +152,12 @@
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>${commons-lang3.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.gatling.highcharts</groupId>
|
||||
<artifactId>gatling-charts-highcharts</artifactId>
|
||||
<version>${gatling.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>jstl</artifactId>
|
||||
@ -174,6 +203,11 @@
|
||||
<artifactId>javax.transaction-api</artifactId>
|
||||
<version>${javax.transaction-api.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.scala-lang</groupId>
|
||||
<artifactId>scala-compiler</artifactId>
|
||||
<version>${scala.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Apache Commons Upload -->
|
||||
<dependency>
|
||||
@ -189,7 +223,6 @@
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<!-- ************* END spring MVC and related dependencies ************** -->
|
||||
<!-- ************* START: Dependencies for Unit and Integration Testing ************** -->
|
||||
<dependency>
|
||||
|
27
webgoat-container/src/test/scala/Simulation.scala
Normal file
27
webgoat-container/src/test/scala/Simulation.scala
Normal file
@ -0,0 +1,27 @@
|
||||
import io.gatling.core.Predef._
|
||||
import io.gatling.http.Predef._
|
||||
import org.apache.commons.lang3.RandomStringUtils
|
||||
|
||||
import scala.concurrent.duration._
|
||||
|
||||
class BasicSimulation extends Simulation {
|
||||
|
||||
val httpConf = http
|
||||
.baseURL("http://localhost:8080/WebGoat/") // Here is the root for all relative URLs
|
||||
.userAgentHeader("Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20100101 Firefox/16.0")
|
||||
|
||||
val scn = scenario("Register and automatic login").
|
||||
exec(session =>
|
||||
session.setAll(("username", RandomStringUtils.randomAlphabetic(10)))
|
||||
)
|
||||
.exec(
|
||||
http("Test")
|
||||
.post("register.mvc")
|
||||
.formParam("username", "${username}")
|
||||
.formParam("password", "${username}")
|
||||
.formParam("matchingPassword", "${username}")
|
||||
.formParam("agree", "agree")
|
||||
)
|
||||
|
||||
setUp(scn.inject(atOnceUsers(100)).protocols(httpConf))
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user