score:5
you have to abide by gatling apis.
- with checks, you don't "fail" the test, but the request. if you're looking for failing the whole test, you should have a look at the assertions api and the jenkins plugin.
- you can only perform a check at the request site, not later. one of the very good reasons is that if you store the bodystring in the sessions like you're doing, you'll end using a lot of memory and maybe crashing (still referenced, so not garbage collectable). you have to perform your
processdata
in the check, typically in the transform optional step.
score:0
i implemented something using exithereiffailed
that sounds like exactly what you were trying to accomplish. i normally use this after a virtual user attempts to sign in.
exithereiffailed
is used this way
val scn = scenario("myawesomescenario")
.exec(http("get data from endpoint 1")
.get(request1url)
.check(status.is(200))
.check(bodystring.saveas("mydata"))
.check(processdata(session.attributes("mydata")).is(true)))
.exithereiffailed // if we weren't able to get the data, don't continue
.exec(http("send the data to endpoint 2")
.post(request2url)
.body(stringbody("${mydata}"))
this scenario will abort gracefully at exithereiffailed
if any of the checks prior to exithereiffailed
have failed.
score:1
since the edit queue is already full.
this is already resolved in the new version of gatling. release 3.4.0
they added
exithereif("${myboolean}")
exithereif(session => true)
make the user exit the scenario from this point if the condition holds. condition parameter is an expression[boolean].
score:2
were you looking for something like
.exec(http("getrequest")
.get("/request/123")
.headers(headers)
.check(status.is(200))
.check(jsonpath("$.request_id").is("123")))
Source: stackoverflow.com
Related Query
- How to fail a Gatling test from within "exec"?
- How can I exec shell scripts from within a Gatling simulation?
- How to access a value stored in a session from within a feeder in Gatling
- How do I get the Scala version from within Scala itself?
- How can I get the name of an Akka actor from within the actor itself?
- How to run a single test in scalatest from maven
- How to run an external file from within the scala interactive interpreter (REPL)?
- How to bring jenkins job to fail when Gatling load tests underperform
- How do I idiomatically handle null checks from within Scala/Lift?
- How to run JavaScript code from within Scala (JVM)?
- Excluding a ScalaTest test when calling my tests from within sbt
- How to execute SBT plugin's tasks from within IntelliJ IDEA CE?
- How to run gatling from code
- How do I actually run the Gatling test via SBT
- Gatling in scala how to get url from redirect
- How SBT test task manages class path and how to correctly start a Java process from SBT test
- How to print accumulator variable from within task (seem to "work" without calling value method)?
- How can I get a return value from ScalaTest indicating test suite failure?
- How to do Slick configuration via application.conf from within custom sbt task?
- How does Scala implement return from within an expression?
- How to test Zentasks sample app from Play 2.0
- How to use ForkOptions in SBT to change working directory for test within subproject?
- How can I find the statements in a Scala program from within a compiler plugin?
- How do I make Gatling capture request while reading from the session?
- How to use a single OAuth2.0 token for Multiple Virtual Users in a Gatling load test
- How to configure sbt/ScalaTest to load test config from dependent project?
- Gatling pass data from feeder to exec
- How to remove a fold from within a for-comprehension?
- How does test fail with both "TestsFailedException" and "Failed 0, Errors 0"
- How do I control order of execution of exec statements in Gatling scenario?
More Query from same tag
- How I know the runtime of a code in scala?
- FileUtil.copyMerge() in AWS S3
- Scala admin framework to build a simple CRUD application?
- Having error while building Spark 1.3.0 JDK 1.6.0_45 maven 3.0.5 CentOS 6
- Play framework compile-time dependency injection and singleton
- Monotonically increasing ID based on column
- WebWorkers and Asynchronous shared data access. How in Scala.js?
- NodeSeqMarshaller with ContentType charset not resolving
- Mock is returning stubbed result for arbitrary param
- Lift Framework BindHelpers.attr Question (or better practice?)
- Trouble referencing packages in IntelliJ Scala
- SBT: how to reuse code with parameters in multiple tasks?
- Shapeless HList appender
- Expansion for non repeated parameter when creating a generic Form function
- Altering the DOM with the Play! Framework
- Terminology in book "FP in Scala" : "we can treat the objects of our APIs as black boxes"
- How can I execute a simple Jar on AWS to perform some operation on S3 buckets
- object import from a different package in Scala in Maven project
- how can I interop kotlin code in an existing SBT scala project
- scala: convert match statement to pattern matching anonymous function - with values
- spark write as string and read partition column as numeric
- unable to store row elements of a dataset, via mapPartitions(), in variables
- FS2 stream to unread InputStream
- Loading JSON file similar to XML in scala
- Create a new column from one of the value available in another columns as an array of Key Value pair
- Type parameterization in Scala
- Split list into multiple lists with fixed number of elements in java 8
- Scala: value :: is not a member of Int
- Running external unix commands in Scala
- Lift Framework can't deserialize JSON data