gatling

Custom DSL by extending Gatling: How to Scala?

南楼画角 提交于 2019-12-23 03:36:22
问题 We're using Gatling to load test our application (and it works great). We're attempting to DRY up some of the code by making composable extensions on the Gatling classes (like ScenarioBuilder / ChainBuilder / etc. found in io.gatling.core.structure). Here is an example of one of our scenarios: val scn = scenario("Whatever") .exec(Authentication.FeederLogin(userCsvFile, password)) .exec(User.ExtractId(User.SignIn())) .exec(FindPeople(50, "personIds")) // SPA load .exec(User.FetchLandingPageFor

Stateful checks in gatling websocket scenario

北战南征 提交于 2019-12-21 17:10:56
问题 I have a gatling scenario where I subscribe to a websocket and want to check the incoming messages for internal consistency. E.g. the messages coming over the websocket are <user>: <sequence number> , and I want to check that for each user string, the sequence number is continuous and increasing from 1. a: 1 b: 1 a: 2 b: 2 a: 1 // <= this would be an error because last a was 2, so should be 3 My first approach was to store something like a Map[String, Int] in a session variable. But it seems

Parsing a Json response returned to Gatling

混江龙づ霸主 提交于 2019-12-21 03:42:13
问题 I am trying to parse a json response returned to gatling by the server. My response from server is: SessionAttribute( Session( GetServices, 3491823964710285818-0, Map( gatling.http.cache.etagStore -> Map(https://api.xyz.com/services -> ), gatling.http.cache.lastModifiedStore -> Map(https://api.xyz.com/services -> ), myresponse -> { "created":"2014-12-16T22:06:59.149+0000", "id":"x8utwb2unq8uey23vpj64t65", "name":"myservice", "updated":"2014-12-16T22:06:59.149+0000", "version":null }),

Gatling - execute scenarios sequentialy

不想你离开。 提交于 2019-12-18 08:31:10
问题 When I run code like: setUp( scenario1.inject(constantUsersPerSec(1) during (1 second)), scenario2.inject(constantUsersPerSec(1) during (1 second)) ).protocol() Both scenarios are started at once. What need to be changed to run it one by one? 回答1: You could start the second scenario with a "nothingFor" injection step setUp( scenario1.inject(constantUsersPerSec(1) during (1 second)), scenario2.inject(nothingFor(1 second) , constantUsersPerSec(1) during (1 second)) ).protocol() If you want to

Data from feeder not available in scenario

好久不见. 提交于 2019-12-13 07:58:44
问题 I have a problem where it looks like data from a feeder isn't added to the session. I'm testing a system where a user has a role (i.e. user or admin) and I need to perform various tests depending on the role. Following the advanced tutorial I have split my chains into different objects (each object in its own file) - one of the objects contain the login procedure which is the same regardless of the users role. I wan't re-use this, but with different feeders. I load the username and password

Can I have a custom Setup method in gatling

心不动则不痛 提交于 2019-12-13 02:08:17
问题 I want to have a custom setup method like for a test where i talk to a webservice and get initial values. Can i do this in gatling?I only want to run this once per simulation. 回答1: You can use the before hook to perform any custom code before running the simulation. Note that you can't use Gatling's DSL in there. But you can use whatever Java HTTP client you want, from java.net.UrlConnection to AsyncHttpClient that Gatling ships. 来源: https://stackoverflow.com/questions/28439925/can-i-have-a

Gatling vs httperf

假如想象 提交于 2019-12-12 15:59:57
问题 I am trying to stress test one simple server with 10K connections per seconds; it's pretty dummy server so this should be possible. When I run gatling, the best I can get is 7K, at 8K we start to receive connection errors. This is again a simple test, ramping to 8k and holding the traffic for 2 minutes. Request 'Home' failed: java.net.ConnectException: Cannot assign requested address I know this error is related to tuning our box (open files etc). I have tried some commands, but that didn't

How to pass a session variable from one object to another in Gatling?

巧了我就是萌 提交于 2019-12-12 08:57:52
问题 I'm extracting session variable in ObjectA and would like to pass it to ObjectB, what is the best way to achieve this? object ObjectA { val foo = exec(jsfPost("Request1", "/something.xhtml") .formParam("SUBMIT", "1") .check(regex("""Count:([^:]*),""").saveAs("Count")) ) .pause(1) .exec { session => val Count = session("Count").as[String].toInt val GroupName = SomeCustomFunc(Count) } .exec(ObjectB.bar) } object ObjectB{ val bar = group(GroupName){ myChain } } Pretty sure I'll feel stupid after

Unable to evaluate EL while creating Gatling scenario

血红的双手。 提交于 2019-12-12 02:16:07
问题 I am creating scenario with repeat block. As I need index based request to be generated. def scnWithLoop() = scenario("scenarioName").repeat(counter, "counter") { exec (session => { val index: Integer = Integer.getInteger(session.attributes.get("counter").get.toString()); session.set("index", index) session }) exec( http("scenarioName") .post(contextPath) .headers(headers) .body(StringBody(getData("${index}".toInt))) .check(status.in(expectedCodes)) ).pause(20 seconds) } But this doesn't

Gatling (performance test):how to perform task in background every x-minutes

本小妞迷上赌 提交于 2019-12-11 18:10:00
问题 I would like to know how to perform a task in the background every x-minutes with Gatling. Background: I want to write a couple of scenario's on our backend. Our backend will be called by another backend in this case. A usual scenario: client (backend) to server authentication (optional) client requests X client requests Y client requests Z I want a scenario where requests 'X, Y and Z' are performed. The problem: The backend(client) to backend (server) authentication is performed with