Add Jenkinsfile & update gatling version (#8198)
This commit is contained in:
parent
0bf12a690c
commit
6067f9cc3c
20
testing-modules/gatling/Jenkinsfile
vendored
Normal file
20
testing-modules/gatling/Jenkinsfile
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
pipeline {
|
||||||
|
agent any
|
||||||
|
stages {
|
||||||
|
stage("Build Maven") {
|
||||||
|
steps {
|
||||||
|
sh 'mvn -B clean package'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage("Run Gatling") {
|
||||||
|
steps {
|
||||||
|
sh 'mvn gatling:test'
|
||||||
|
}
|
||||||
|
post {
|
||||||
|
always {
|
||||||
|
gatlingArchive()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -15,6 +15,7 @@
|
|||||||
<relativePath>../../</relativePath>
|
<relativePath>../../</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -94,43 +95,26 @@
|
|||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
<profiles>
|
|
||||||
<profile>
|
|
||||||
<id>simulation</id>
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>io.gatling</groupId>
|
<groupId>io.gatling</groupId>
|
||||||
<artifactId>gatling-maven-plugin</artifactId>
|
<artifactId>gatling-maven-plugin</artifactId>
|
||||||
<version>${gatling-maven-plugin.version}</version>
|
<version>${gatling-maven-plugin.version}</version>
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<phase>test</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>execute</goal>
|
|
||||||
</goals>
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<disableCompiler>true</disableCompiler>
|
<simulationClass>org.baeldung.RecordedSimulation</simulationClass>
|
||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
</profile>
|
|
||||||
</profiles>
|
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>1.8</maven.compiler.source>
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
<maven.compiler.target>1.8</maven.compiler.target>
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
<encoding>UTF-8</encoding>
|
<encoding>UTF-8</encoding>
|
||||||
<scala.version>2.12.6</scala.version> <!--2.11.12 --> <!--2.12.6 -->
|
<scala.version>2.12.6</scala.version> <!--2.11.12 --> <!--2.12.6 -->
|
||||||
<gatling.version>2.3.1</gatling.version> <!--2.2.5 --> <!--2.3.1 -->
|
<gatling.version>3.3.1</gatling.version> <!--2.2.5 --> <!--2.3.1 -->
|
||||||
<scala-maven-plugin.version>3.2.2</scala-maven-plugin.version> <!--3.2.2 --> <!--3.3.2 -->
|
<scala-maven-plugin.version>4.3.0</scala-maven-plugin.version> <!--3.2.2 --> <!--3.3.2 -->
|
||||||
<gatling-maven-plugin.version>2.2.4</gatling-maven-plugin.version> <!--2.2.1 --> <!--2.2.4 -->
|
<gatling-maven-plugin.version>3.0.4</gatling-maven-plugin.version> <!--2.2.1 --> <!--2.2.4 -->
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
@ -3,11 +3,10 @@ import io.gatling.core.config.GatlingPropertiesBuilder
|
|||||||
|
|
||||||
object Engine extends App {
|
object Engine extends App {
|
||||||
|
|
||||||
val props = new GatlingPropertiesBuilder
|
val props = new GatlingPropertiesBuilder()
|
||||||
props.dataDirectory(IDEPathHelper.dataDirectory.toString)
|
.resourcesDirectory(IDEPathHelper.resourcesDirectory.toString)
|
||||||
props.resultsDirectory(IDEPathHelper.resultsDirectory.toString)
|
.resultsDirectory(IDEPathHelper.resultsDirectory.toString)
|
||||||
props.bodiesDirectory(IDEPathHelper.bodiesDirectory.toString)
|
.binariesDirectory(IDEPathHelper.mavenBinariesDirectory.toString)
|
||||||
props.binariesDirectory(IDEPathHelper.mavenBinariesDirectory.toString)
|
|
||||||
|
|
||||||
Gatling.fromMap(props.build)
|
Gatling.fromMap(props.build)
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ import io.gatling.commons.util.PathHelper._
|
|||||||
|
|
||||||
object IDEPathHelper {
|
object IDEPathHelper {
|
||||||
|
|
||||||
val gatlingConfUrl: Path = getClass.getClassLoader.getResource("gatling.conf").toURI
|
val gatlingConfUrl: Path = getClass.getClassLoader.getResource("gatling.conf")
|
||||||
val projectRootDir = gatlingConfUrl.ancestor(3)
|
val projectRootDir = gatlingConfUrl.ancestor(3)
|
||||||
|
|
||||||
val mavenSourcesDirectory = projectRootDir / "src" / "test" / "scala"
|
val mavenSourcesDirectory = projectRootDir / "src" / "test" / "scala"
|
||||||
@ -12,11 +12,8 @@ object IDEPathHelper {
|
|||||||
val mavenTargetDirectory = projectRootDir / "target"
|
val mavenTargetDirectory = projectRootDir / "target"
|
||||||
val mavenBinariesDirectory = mavenTargetDirectory / "test-classes"
|
val mavenBinariesDirectory = mavenTargetDirectory / "test-classes"
|
||||||
|
|
||||||
val dataDirectory = mavenResourcesDirectory / "data"
|
val resourcesDirectory = mavenResourcesDirectory
|
||||||
val bodiesDirectory = mavenResourcesDirectory / "bodies"
|
val recorderSimulationsDirectory = mavenSourcesDirectory
|
||||||
|
|
||||||
val recorderOutputDirectory = mavenSourcesDirectory
|
|
||||||
val resultsDirectory = mavenTargetDirectory / "gatling"
|
val resultsDirectory = mavenTargetDirectory / "gatling"
|
||||||
|
|
||||||
val recorderConfigFile = mavenResourcesDirectory / "recorder.conf"
|
val recorderConfigFile = mavenResourcesDirectory / "recorder.conf"
|
||||||
}
|
}
|
||||||
|
@ -3,10 +3,10 @@ import io.gatling.recorder.config.RecorderPropertiesBuilder
|
|||||||
|
|
||||||
object Recorder extends App {
|
object Recorder extends App {
|
||||||
|
|
||||||
val props = new RecorderPropertiesBuilder
|
val props = new RecorderPropertiesBuilder()
|
||||||
props.simulationOutputFolder(IDEPathHelper.recorderOutputDirectory.toString)
|
.simulationsFolder(IDEPathHelper.recorderSimulationsDirectory.toString)
|
||||||
props.simulationPackage("org.baeldung")
|
.simulationPackage("org.baeldung")
|
||||||
props.bodiesFolder(IDEPathHelper.bodiesDirectory.toString)
|
.resourcesFolder(IDEPathHelper.resourcesDirectory.toString)
|
||||||
|
|
||||||
GatlingRecorder.fromMap(props.build, Some(IDEPathHelper.recorderConfigFile))
|
GatlingRecorder.fromMap(props.build, Some(IDEPathHelper.recorderConfigFile))
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ import io.gatling.jdbc.Predef._
|
|||||||
class RecordedSimulation extends Simulation {
|
class RecordedSimulation extends Simulation {
|
||||||
|
|
||||||
val httpProtocol = http
|
val httpProtocol = http
|
||||||
.baseURL("http://computer-database.gatling.io")
|
.baseUrl("http://computer-database.gatling.io")
|
||||||
.inferHtmlResources(BlackList(""".*\.css""", """.*\.js""", """.*\.ico"""), WhiteList())
|
.inferHtmlResources(BlackList(""".*\.css""", """.*\.js""", """.*\.ico"""), WhiteList())
|
||||||
.acceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")
|
.acceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")
|
||||||
.acceptEncodingHeader("gzip, deflate")
|
.acceptEncodingHeader("gzip, deflate")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user