-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
jugando un poco con las distintas formas de inyeccion que tiene gatling
- Loading branch information
Esteban Montes
committed
Apr 30, 2018
1 parent
331440a
commit 9d4c937
Showing
2 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
simulations/RestService/IncidenceRESTServiceSimulationRandomized.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import scala.concurrent.duration._ | ||
|
||
import io.gatling.core.Predef._ | ||
import io.gatling.http.Predef._ | ||
import io.gatling.jdbc.Predef._ | ||
|
||
|
||
/** | ||
Tutorial probando REST API: https://www.blazemeter.com/blog/api-load-testing-with-gatling | ||
Se crean 1000 incidencias a lo largo de 35 segundos, en menos segundos empieza a haber problemas, 10k a lo largo de 350s | ||
Las incidencias seran creadas en intervalos random de tiempo | ||
*/ | ||
|
||
class IncidenceRESTServiceSimulation extends Simulation { | ||
|
||
val httpProtocol = http | ||
.baseURL("http://localhost:8090") | ||
.inferHtmlResources() | ||
.acceptHeader("*/*") | ||
.contentTypeHeader("application/json") | ||
.userAgentHeader("curl/7.54.0") | ||
|
||
val scn = scenario("IncidenceRESTServiceSimulation") | ||
.exec(http("request_0") | ||
.post("/incidence-creator") | ||
.body(StringBody(""" {"ident":"entidad2","password":"123456","kind":2,"name":"inc_GHKB","description":"Nueva lectura de humedad","location":"2919,178","tags":["Nieve","Fuego","Niebla","Terremoto"],"additionalInformation":"http://puntoverdeleon.com.mx/wp-content/uploads/2016/09/imagen-de-prueba-320x240.jpg","properties":{"p0":"v0","p1":"v1","p2":"v2","p3":"v3"},"state":"Abierta","notification":"si","expireAt":"2018-10-25 10:02:29.769579","assignedTo":"oper_rUxl"} """)).asJSON | ||
) | ||
|
||
setUp(scn.inject(rampUsers(1000) over(35 seconds) randomized)).protocols(httpProtocol) | ||
} |
29 changes: 29 additions & 0 deletions
29
simulations/RestService/IncidenceRESTServiceSimulationRanged.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import scala.concurrent.duration._ | ||
|
||
import io.gatling.core.Predef._ | ||
import io.gatling.http.Predef._ | ||
import io.gatling.jdbc.Predef._ | ||
|
||
|
||
/** | ||
Tutorial probando REST API: https://www.blazemeter.com/blog/api-load-testing-with-gatling | ||
Se intentaran crear entre 500 y 1000 incidencias a lo largo de 20 segundos | ||
*/ | ||
|
||
class IncidenceRESTServiceSimulationRanged extends Simulation { | ||
|
||
val httpProtocol = http | ||
.baseURL("http://localhost:8090") | ||
.inferHtmlResources() | ||
.acceptHeader("*/*") | ||
.contentTypeHeader("application/json") | ||
.userAgentHeader("curl/7.54.0") | ||
|
||
val scn = scenario("IncidenceRESTServiceSimulationRanged") | ||
.exec(http("request_0") | ||
.post("/incidence-creator") | ||
.body(StringBody(""" {"ident":"entidad2","password":"123456","kind":2,"name":"inc_GHKB","description":"Nueva lectura de humedad","location":"2919,178","tags":["Nieve","Fuego","Niebla","Terremoto"],"additionalInformation":"http://puntoverdeleon.com.mx/wp-content/uploads/2016/09/imagen-de-prueba-320x240.jpg","properties":{"p0":"v0","p1":"v1","p2":"v2","p3":"v3"},"state":"Abierta","notification":"si","expireAt":"2018-10-25 10:02:29.769579","assignedTo":"oper_rUxl"} """)).asJSON | ||
) | ||
|
||
setUp(scn.inject(rampUsersPerSec(500) to (1000) during(20 seconds))).protocols(httpProtocol) | ||
} |