feat: NCS-62, NCS-64 Endurance Test, Spike Test (#6)
Added two new types of tests --------- Co-authored-by: LQ63 <lkhermann@web.de> Reviewed-on: #6
This commit was merged in pull request #6.
This commit is contained in:
+6
-1
@@ -26,7 +26,12 @@ tasks.withType(io.gatling.gradle.GatlingRunTask) {
|
|||||||
"-DstartUsers=${findProperty('startUsers') ?: '2'}",
|
"-DstartUsers=${findProperty('startUsers') ?: '2'}",
|
||||||
"-DusersIncrement=${findProperty('usersIncrement') ?: '2'}",
|
"-DusersIncrement=${findProperty('usersIncrement') ?: '2'}",
|
||||||
"-Dsteps=${findProperty('steps') ?: '2'}",
|
"-Dsteps=${findProperty('steps') ?: '2'}",
|
||||||
"-DstepDuration=${findProperty('stepDuration') ?: '30'}"
|
"-DstepDuration=${findProperty('stepDuration') ?: '30'}",
|
||||||
|
"-DconcurrentUsers=${findProperty('concurrentUsers') ?: '3'}",
|
||||||
|
"-Dduration=${findProperty('duration') ?: '300'}",
|
||||||
|
"-DbaselineUsers=${findProperty('baselineUsers') ?: '2'}",
|
||||||
|
"-DbaselineDuration=${findProperty('baselineDuration') ?: '20'}",
|
||||||
|
"-DspikeUsers=${findProperty('spikeUsers') ?: '15'}"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ object BoardEndpoints {
|
|||||||
|
|
||||||
val createGame: Endpoint = Endpoint(
|
val createGame: Endpoint = Endpoint(
|
||||||
name = "Create Game",
|
name = "Create Game",
|
||||||
method = "POST",
|
method = "GET",
|
||||||
path = "/api/board/game/",
|
path = "/api/account/official-bots/",
|
||||||
expectedStatus = 201
|
// expectedStatus = 200
|
||||||
)
|
)
|
||||||
|
|
||||||
val all: List[Endpoint] = List(createGame)
|
val all: List[Endpoint] = List(createGame)
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package simulations
|
||||||
|
|
||||||
|
import base.BaseSimulation
|
||||||
|
import endpoints.BoardEndpoints
|
||||||
|
import io.gatling.core.Predef._
|
||||||
|
|
||||||
|
import scala.concurrent.duration._
|
||||||
|
|
||||||
|
class EnduranceTestSimulation extends BaseSimulation {
|
||||||
|
|
||||||
|
private val concurrentUsers = sys.props.getOrElse("concurrentUsers", "3").toInt
|
||||||
|
private val duration = sys.props.getOrElse("duration", "300").toInt
|
||||||
|
|
||||||
|
setUp(
|
||||||
|
BoardEndpoints.all.map { endpoint =>
|
||||||
|
scenarioFromEndpoint(endpoint)
|
||||||
|
.inject(
|
||||||
|
constantConcurrentUsers(concurrentUsers).during(duration.seconds)
|
||||||
|
)
|
||||||
|
}: _*
|
||||||
|
).protocols(httpProtocol)
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package simulations
|
||||||
|
|
||||||
|
import base.BaseSimulation
|
||||||
|
import endpoints.BoardEndpoints
|
||||||
|
import io.gatling.core.Predef._
|
||||||
|
|
||||||
|
import scala.concurrent.duration._
|
||||||
|
|
||||||
|
class SpikeTestSimulation extends BaseSimulation {
|
||||||
|
|
||||||
|
private val baselineUsers = sys.props.getOrElse("baselineUsers", "2").toInt
|
||||||
|
private val baselineDuration = sys.props.getOrElse("baselineDuration", "20").toInt
|
||||||
|
private val spikeUsers = sys.props.getOrElse("spikeUsers", "15").toInt
|
||||||
|
|
||||||
|
setUp(
|
||||||
|
BoardEndpoints.all.map { endpoint =>
|
||||||
|
scenarioFromEndpoint(endpoint)
|
||||||
|
.inject(
|
||||||
|
constantUsersPerSec(baselineUsers).during(baselineDuration.seconds),
|
||||||
|
atOnceUsers(spikeUsers),
|
||||||
|
nothingFor(5.seconds),
|
||||||
|
constantUsersPerSec(baselineUsers).during(baselineDuration.seconds)
|
||||||
|
)
|
||||||
|
}: _*
|
||||||
|
).protocols(httpProtocol)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user