Questions tagged [scala-gatling]

1

votes
2

answer
463

Views

How get access_token from body for use in another method

Good afternoon. Slightly confused in the Gatling documentation, I can not find a solution. I want to get a token to use in another method as a header. Here is an example of the first method where I get a token: exec( http('HTTP Request auth') .post('http://blabla:9001/connect/token') .header('Conten...
denchik_muh
1

votes
1

answer
380

Views

Custom assertion on Gatling

Is it possible to create a custom assert based on a boolean value? Something like this: setUp(scn.inject(rampUsers(7) over (1 minutes))).protocols(httpProtocol). assertions( assert(/*method that returns boolean value*/), /*other assertions*/ ) Thanks!
Matias Fornara
1

votes
1

answer
176

Views

Why does Gatling stop simulation when any scenario exists and doesn't wait until the end?

Let's say I have this configuration val scn = (name: String) => scenario(name) .forever() { .exec(request) } setUp( scn('scn1').inject(atOnceUsers(1)) .throttle( jumpToRps(1), holdFor(10 seconds) ), scn('scn2').inject(atOnceUsers(1)) .throttle(jumpToRps(1), holdFor(20 seconds)) ).protocols(http.base...
user219882
0

votes
0

answer
3

Views

JsonPath Path Not Found Exception While Data Driving From Jsonfile So As To Randomize the data

Is there a Issue to use below code,basically data driving from Jsonfile ,I am creating random numbers below that is eventidStart and eventidEnd are fetching their respective values from Json file which is shown below var idNumbers=(eventidStart to eventidEnd).iterator def eventidStart: Int = JsonP...
Tk infostrings
1

votes
1

answer
141

Views

Custom DSL by extending Gatling: How to Scala?

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...
Levi
1

votes
0

answer
588

Views

Gatling checkIf syntax

A legacy app has the below working Gatling test private val getUserByTuid = scenario('GetActiveUserInfoWrapper') .feed(users.toArray.circular) .exec( http('GET /v1/foo/{id}') .get('/v1/foo/${id}') .header('Content-Type', 'application/json') .header('User-Agent', 'gatling') .check(status is 200) .che...
fred
1

votes
1

answer
189

Views

Run gatling project from an executable jar

I have a small Gatling project which I would like to package through sbt and then run on different Linux/Windows machines with different JVM parameters. I tried already the sbt package command but that didn't work out. Anyone has done something similar before?
user134
1

votes
2

answer
358

Views

How to read a JSON file into a Map, using Scala

How can I read a JSON file into a Map, using Scala. I've been trying to accomplish this but the JSON I am reading is nested JSon and I have not found a way to easily extract the JSON into keys because of that. Scala seems to be wanting to also convert the nested JSON String into an object. Instead...
djangofan
1

votes
1

answer
167

Views

Gatling: Random Feeder POST request: not found: value email (Gatling 3.0.0)

**Randomized Load Testing with Gatling ** I want to test my built API for higher load, and therefore, I have to generate huge amount of random emails (I know there is currently no email-checking on the server, so I just create random strings). The tool I use is gatling-charts-highcharts-bundle-3.0....
themysteriousM
1

votes
1

answer
30

Views

How to send the file returned from a function over post in GatLing-Scala?

def siteNameChange():File={ for(linesiteNameChange())).asJSON) Hello I am a newbie to Gatling, using it for performance testing. I have a function named siteNameChange() which returns a file after doing some modifications on the file. This function I am calling in the scenario body to send the data....
Yash Bansal
1

votes
0

answer
61

Views

How to extract field from JSON file with Gatling

I'm new in Gatling and Scala. I'm trying to write scenarios to test an API and do some http requests. I have a JSON file with an array of object. I'd like to extract the ID field in order to achieve an http request with it (multiple get). I'm trying to use feeder, i'm not sure about how it's working...
Yoann
1

votes
0

answer
29

Views

Extract or get parameters from url in Gatling

In Gatling how do I proceed to extract or get and save the Url parameters from response body? I make a post request and as response body a I got a link with parameters (pstId & autId) that I would like to extract and save them: /**** HTTP Calls ****/ def getResource() = { exec( http('psu initiates p...
gerard talla
0

votes
0

answer
3

Views

How to properly use checkIf with multiple jsonPath extractions

I've got scenario that I send GET request which sometimes can return 404 and I don't want to report it as an error on the final reports. Additionally if that request is successful I need to extract multiple values from json response. Generally those 2 actions I want to use work for me fine when used...
Michal
1

votes
0

answer
8

Views

Use content of a tuple as variable session

I extracted from a previous response an Object of tuple with the following regex : .check(regex(''''idSc':(.{1,8}),'pasTemps':.'codePasTemps':(.),'''').ofType[(String,String)].findAll.saveAs ('OBJECTS1')) So I get my object : OBJECTS1 -> List((1657751...
Piixon
1

votes
1

answer
233

Views

(scala) Gatling headerRegex throws implicit value exception

I am trying to run gatling test where it logs in and checks and store the value of a cookie. Here's the code snippet that I have: .pause(minWait, maxWait) .feed(usernames) .exec( http('_pLoginForm_Basic') .post('${postUrl}') .headers(headers_0) .formParam('username', '${username}') .formParam('passw...
sirhc
1

votes
1

answer
305

Views

Cannot save variables in Gatling session when validated with 'checkIf'

I have an API with 2 possible responses. I have the below HTTP builder: http('HelloTest') .post(host + '/hello') .headers(someHeader) .body(StringBody(requestPayload)) .check(status.saveAs('responseStatus')) .check(checkIf((response: Response, session: Session) => session('responseStatus').as[Strin...
Deepti K
1

votes
1

answer
219

Views

How to capture gatling.io https / wss calls through fiddler?

I'm running gatling.io to load test my server, but I would like to be able to view the calls so I can debug portions of the script. I know I can have it write all the logs to the console, but viewing through fiddler is nicer.
CamHart
1

votes
1

answer
0

Views

Setup Gatling tests to limit by number of requests

So, I've written a few Gatling tests and know how to write test setup for a max duration. setUp(testScenario.inject(atOnceUsers(3))).maxDuration(5 minutes) Now, I want to achieve something along this: setUp(testScenario.inject(atOnceUsers(3))).maxRequests(1000 requests) How should I approach that? H...
Viv
1

votes
1

answer
1.8k

Views

Send Authorization Token | Gatling

I am performance testing our Enterprise API using Gatling. While testing with 'Postman' I used to pass following Headers: API Key Authorization Bearer Token It would be great if someone could help me: How can I pass 'API-KEY' and 'Authorization Bearer' token as a header in a Gatling request? Please...
Sunil
1

votes
1

answer
1.1k

Views

How to set a cookie for a Gatling scenario

I have the following code. The problem is that the cookie is not being set for the requests that follow. I would like to set a single cookie that is used by all of the subsequent requests (including the ajaxRequests). val get = scenario('Page') .feed(myfeed) .group('Home Page') { exec(session => set...
Questioning
1

votes
1

answer
254

Views

Gatling.io share data between virtual users

I'm using Gatling.io to test a website. I have a scenario with multiple virtual users. val users = scenario('Users').exec(Session.browse) val admins = scenario('Admins').exec(Session.create) I want the admin user to create a 'session' on the website I'm testing, save the session name from the result...
Shengis
1

votes
1

answer
206

Views

How to simulate Media Streaming with Gatling

So in my simulation I need to replicate a page that contains a media player and streams a video also from the same backend. Using the Get request from Gatling, it will download the entire video at once, instead of downloading only partial content like in a browser would happen. Is there a way to con...
Gery
1

votes
2

answer
52

Views

header(“Accept”, “application/json;v=1”) doesn't work in Gatling tests?

For some reason http('Update WishList') .put('/api/update/${id}') .header('Accept', 'application/json;v=1') .body(ELFileBody('bodies.json')).asJSON .check(status.is(200)) causes > status.find.is(202), but actually found 406 But I know the service expects 'application/json;v=1' Checked the actual req...
Lenar
2

votes
4

answer
1.2k

Views

Alternative to Gatling

I’ve been having issues lately because my dependencies has been updated to use netty 4.1 and Gatling has not been updated for a while, and still work only on Netty 4.0. Anybody knows any alternative to Gatling to create similar Simulations and scenarios for the performance test to be run automati...
paul
2

votes
2

answer
2.7k

Views

Error in Gatling maven plugin

I´m using gatling-maven-plugin to run some Performance test. I just follow the official documentation http://gatling.io/docs/2.2/extensions/maven_plugin/ I have this configuration io.gatling gatling-maven-plugin 2.2.4 ${project.basedir}/src/test/resources ${project.basedir}/src/test/resources/data...
paul
2

votes
1

answer
56

Views

Is there a recommended way to parameterise Gatling simulations?

I'd like to be able to run Gatling via SBT and parameterize the number of constant users per second and the total duration of the simulation. Something like: setUp(testScenario.inject(constantUsersPerSec() during( )) What would be the best way to pass arguments to SBT and read them in the Simulation...
Gabriel C
2

votes
0

answer
456

Views

Using gatling session variable in triple qouted string

How to use session variable in StringBody of gatling? I have defined my exec like, val migrateAsset = exec(_.set('assetId', AssetIdGenerator.generateRandomAssetId())) .exec(http('Migrate Asset') .post(s'$url/asset/metadata') .header('Content-Type', 'application/json') .header('Authorization', s'Bear...
Aditya
2

votes
1

answer
368

Views

How do i perform conditional check using Gatling

I have a scenario like this. private val feeder = Array(200, 404).map(e => Map('code' -> e)).random.circular private val search = scenario('search') .feed(feeder) .exec(http('search') .get('/search/') .headers(headers) .check( if '${code}'.equals(200) jsonPath('$.body').exists else jsonPath('$.excep...
Sarath
0

votes
0

answer
7

Views

Gatling http response 403

I recorded a Gatling load test with 1 user . When executing the corresponding recorded test script, It shows warning like 'status.find.is(200), but actually found 403' As a fresher to Gatling and Scala I couldn't resolve the issue. P .exec(http('Login_Check') .post('*************************') .head...
satish
2

votes
0

answer
117

Views

Best practices for sharing gatling testing base

I need an advice on the code organisation and the tests sharing. Let me start with describing the situation: we have an architecture where every separate team develops its own unique business component and their codebases don't really interfere with each other with each other. These are Node.js proj...
Konstantin Bodnia
2

votes
0

answer
136

Views

Stop Gatling simulation when 99th percentile timeout greater than a specific time

I'm running a simulation in order to load test an endpoint. The way I'm doing it is by running a simulation in which an n number of users make requests to the endpoint at the same time, for a short amount of time, and at the end checking the results, and then, with the results, adjust the amount of...
Cas1337
1

votes
3

answer
461

Views

Send random request with Gatling

I have a file with a Json request bodies in a file. I'd like to benchmark a web sending a constant number of requests per second, using the constantUsersPerSec(..). However, every time a request is sent, I would like it to be taken from a list of requests (randomly, or in a loop, I don't care). I ca...
Michael P
6

votes
1

answer
452

Views

Load performance testing with Gatling and Content-Type

I am using gatling for load performance testing on a brand new API. It seems fairly easy and well documented but I am facing an issue as simple as POST a request with Content-Type set to 'application/vnd.api+json' on the Header. All works well when doing the GET stuff but when launching a POST test...
Sofia
3

votes
2

answer
4.7k

Views

Gatling: How to display full HTTP response body in the console or print it into a file

I'm new to Gatling. I could not find a simple complete example on how to see the full HTTP response body. This is my simple example class CreateNotecard extends Simulation { val baseURL = 'https://portal.apps.stg.bluescape.com' val httpConf = http .baseURL(baseURL) .userAgentHeader('Mozilla/5....
Vladimir
0

votes
0

answer
96

Views

Gatling plugin Errors

I have the example from https://github.com/gatling/gatling-maven-plugin-demo It works for me everything is fine but if I try to add my own simulation or change the simulation from the example I get Update: just removed my own simulation and now it doesn't work haven't a clue. error while starting up...
TOTOROCATBUS
1

votes
1

answer
1.3k

Views

Gatling - Is there way to run multiple simulation files at the same

I have multiple simulation files testing multiple scenarios. I would like to run all of them at the same time in windows. Is there a programmatic or a commandline way to run all the simulations from each file
sam