Skip to content

Commit

Permalink
[SCALA-568] Point gatling to a scala REST API
Browse files Browse the repository at this point in the history
  • Loading branch information
bpstelios10 committed Jan 17, 2025
1 parent 3d19540 commit 28863da
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
8 changes: 6 additions & 2 deletions scala-gatling/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
- [Testing With Gatling Using Scala]()

### Gatling Executions
compile tests: `sbt test:compile`
then run the simulation: `sbt 'Gatling/testOnly com.baeldung.gatling.PeakLoadSimulation'`
From this module's folder, we first compile tests: `sbt test:compile`

Then run the simulation: `sbt 'Gatling/testOnly com.baeldung.gatling.PeakLoadSimulation'`

**Notes**: in order to spin-up the right API this example uses, we also need to start the server:
`sbt resApi/run` from root folder
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ class PeakLoadSimulation extends Simulation {
setUp(
getScenario(
"getExistingEndpoint",
simpleRequest("request_status_endpoint", "/health/status", 200),
simpleRequest("request_todo_endpoint", "/todo", 200),
50,
10,
60
),
getScenario(
"nonExistingEndpoint",
simpleRequest("request_wrong_endpoint", "/health/status1", 200),
simpleRequest("request_wrong_endpoint", "/not-todo", 200),
5,
10,
60
)
).assertions(
details("request_status_endpoint").successfulRequests.percent.gt(99.99),
details("request_status_endpoint").responseTime.percentile4.lt(20),
details("request_status_endpoint").requestsPerSec.gt(40),
details("request_todo_endpoint").successfulRequests.percent.gt(99.99),
details("request_todo_endpoint").responseTime.percentile4.lt(20),
details("request_todo_endpoint").requestsPerSec.gt(40),
details("request_wrong_endpoint").successfulRequests.percent.lt(1),
details("request_wrong_endpoint").responseTime.percentile4.lt(20)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import scala.language.postfixOps
object ScenariosProvider {

private val httpProtocol =
http.baseUrl("http://localhost:8080").disableCaching.disableFollowRedirect
http.baseUrl("http://localhost:9000").disableCaching.disableFollowRedirect

def getScenario(
scenarioName: String,
Expand Down

0 comments on commit 28863da

Please sign in to comment.