Skip to content

Commit

Permalink
atualiza script de teste. Faz um post e depois 5 gets em paralelo par…
Browse files Browse the repository at this point in the history
…a testar consistencia das 2 apis
  • Loading branch information
viniciusfcf committed Feb 18, 2024
1 parent 8667a6a commit d64d7c2
Showing 1 changed file with 43 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,49 @@ class RinhaBackendCrebitosSimulation
jmesPath("ultimas_transacoes[1].tipo").ofType[String].is("c"),
jmesPath("ultimas_transacoes[1].valor").ofType[Int].is("1")
)
)
)
.exec( // Testando uma possivel inconsistencia no extrato
http("validações")
.post("/clientes/#{id}/transacoes")
.header("content-type", "application/json")
.body(StringBody(s"""{"valor": 1, "tipo": "c", "descricao": "danada"}"""))
.check(
status.in(200),
jmesPath("saldo").saveAs("saldo"),
jmesPath("limite").saveAs("limite")
)
.resources(//depois do POST, faco 5 gets em paralelo
http("validações").get("/clientes/#{id}/extrato").check(
jmesPath("ultimas_transacoes[0].descricao").ofType[String].is("danada"),
jmesPath("ultimas_transacoes[0].tipo").ofType[String].is("c"),
jmesPath("ultimas_transacoes[0].valor").ofType[Int].is("1"),
jmesPath("saldo.limite").ofType[String].is("#{limite}"),
jmesPath("saldo.total").ofType[String].is("#{saldo}")
),
http("validações").get("/clientes/#{id}/extrato").check(
jmesPath("ultimas_transacoes[0].descricao").ofType[String].is("danada"),
jmesPath("ultimas_transacoes[0].tipo").ofType[String].is("c"),
jmesPath("ultimas_transacoes[0].valor").ofType[Int].is("1"),
jmesPath("saldo.limite").ofType[String].is("#{limite}"),
jmesPath("saldo.total").ofType[String].is("#{saldo}")
),
http("validações").get("/clientes/#{id}/extrato").check(
jmesPath("ultimas_transacoes[0].descricao").ofType[String].is("danada"),
jmesPath("ultimas_transacoes[0].tipo").ofType[String].is("c"),
jmesPath("ultimas_transacoes[0].valor").ofType[Int].is("1"),
jmesPath("saldo.limite").ofType[String].is("#{limite}"),
jmesPath("saldo.total").ofType[String].is("#{saldo}")
),
http("validações").get("/clientes/#{id}/extrato").check(
jmesPath("ultimas_transacoes[0].descricao").ofType[String].is("danada"),
jmesPath("ultimas_transacoes[0].tipo").ofType[String].is("c"),
jmesPath("ultimas_transacoes[0].valor").ofType[Int].is("1"),
jmesPath("saldo.limite").ofType[String].is("#{limite}"),
jmesPath("saldo.total").ofType[String].is("#{saldo}")
)
)
)

.exec(
http("validações")
.post("/clientes/#{id}/transacoes")
Expand Down

0 comments on commit d64d7c2

Please sign in to comment.