Gatling load testing and running scenarios

theartv

I am looking to create three scenarios:

  • The first scenario will run a bunch of GET requests for 30s
  • The second and third scenarios will run in parallel and wait until the first is finished.

I want the requests from the first scenario to be excluded from the report.

I have the basic outline of what I want to achieve but not seeing expected results:

val myFeeder = csv("somefile.csv")

val scenario1 = scenario("Get stuff")
.feed(myFeeder)
.during(30 seconds) {
  exec(
      http("getStuff(${csv_colName})").get("/someEndpoint/${csv_colName}")
  )
}

val scenario2 = ...

val scenario3 = ...

setUp(
  scenario1.inject(
    constantUsersPerSec(20) during (30 seconds)
  ).protocols(firstProtocaol),


  scenario2.inject(
    nothingFor(30 seconds), //wait 30s
    ...
  ).protocols(secondProt)

  scenario3.inject(
    nothingFor(30 seconds),  //wait 30s
    ...
  ).protocols(thirdProt)

)

I am seeing the first scenario being run throughout the entire test. It doesn't stop after the 30s?

For the first scenario I would like to cycle through the CSV file and perform a request for each line. Perhaps 5-10 requests per second, how do I achieve that?

I would also like it to stop after the 30s and then run the other two in parallel. Hence the nothingFor in last two scenarios above.

Also how do I exclude from report, is it possible?

Thanks

James Warr

You are likely not getting the expected results due to the combination of settings between your injection profile and your "Get Stuff" scenario.

constantUsersPerSec(20) during (30 seconds)

will start 20 users on scenario "Get Stuff" every second for 30 seconds. So even during the 30th second, 20 users will START "Get Stuff". The injection pofile only controls when a user starts, not how long they are active for. So when a user executes the "Get Stuff" scenario, they make the 'get' request repeatedly over the course of 30 seconds due to the .during loop.

So at the very least, you will have users executing "Get Stuff" for 60 seconds - well into the execution of your other scenarios. Depending on the execution time for you getStuff call, it may be even longer.

To avoid this, you could work out exactly how long you want the "Get Stuff" scenario to run, set that in the injection profile and have no looping in the scenario. Alternatively, you could just set your 'nothingFor' values to be >60s.

To exclude the Get Stuff calls from reports, you can add silencing to the protocol definition (assuming it's not shared with your other requests). More details at https://gatling.io/docs/3.2/http/http_protocol/#silencing

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Load testing basic authentication with parameters with Gatling - Scala

From Dev

Difference between these 2 scenarios in load testing

From Dev

Conditionals based on Gatling scenarios

From Dev

Passing arguments between Gatling scenarios and simulation

From Dev

Passing arguments between Gatling scenarios and simulation

From Dev

Running Gatling without interactive options

From Dev

Why is this Gatling job not running sequentially?

From Dev

Dynamic header in gatling load test

From Dev

How can i share an auth token over multiple gatling scenarios?

From Dev

Gatling: Can ramping up of individual scenarios be done just like the users?

From Dev

Unit testing : 2 scenarios in one test?

From Dev

Testing Twilio app with multiple requests and different scenarios

From Dev

Executing Gatling load tests from SBT

From Dev

Gatling - run load tests in cluster / scaling out

From Dev

Build executable JAR for Gatling load test

From Dev

Can gatling load test SQL database or MongoDB?

From Dev

Gatling Load test Error : 406 not acceptable on Response

From Dev

Difference between Jmeter load test scenarios

From Dev

Gatling throws InvalidActorNameException when testing long-poll HTTP requests

From Dev

Gatling Pass TestCase ChainBuilder Array["TC01","TC02", ...] dynamically to Scenarios

From Dev

Load Testing CassandraDB with JMeter

From Dev

Spring load testing

From Dev

Load or Stress Testing in nodejs

From Dev

Load testing a notification hub

From Dev

Load or Stress Testing in nodejs

From Dev

Error while running unit test cases through Jenkins: Could not load file or assembly 'Microsoft.QualityTools.Testing.Fakes, Version=11.0.0.0'

From Dev

Testing advanced scenarios using JMeter Mail Reader sampler

From Dev

Gatling load tests and ScalaTest unit tests in same Play project

From Dev

gatling load test with three REST APIs with different throughputs

Related Related

  1. 1

    Load testing basic authentication with parameters with Gatling - Scala

  2. 2

    Difference between these 2 scenarios in load testing

  3. 3

    Conditionals based on Gatling scenarios

  4. 4

    Passing arguments between Gatling scenarios and simulation

  5. 5

    Passing arguments between Gatling scenarios and simulation

  6. 6

    Running Gatling without interactive options

  7. 7

    Why is this Gatling job not running sequentially?

  8. 8

    Dynamic header in gatling load test

  9. 9

    How can i share an auth token over multiple gatling scenarios?

  10. 10

    Gatling: Can ramping up of individual scenarios be done just like the users?

  11. 11

    Unit testing : 2 scenarios in one test?

  12. 12

    Testing Twilio app with multiple requests and different scenarios

  13. 13

    Executing Gatling load tests from SBT

  14. 14

    Gatling - run load tests in cluster / scaling out

  15. 15

    Build executable JAR for Gatling load test

  16. 16

    Can gatling load test SQL database or MongoDB?

  17. 17

    Gatling Load test Error : 406 not acceptable on Response

  18. 18

    Difference between Jmeter load test scenarios

  19. 19

    Gatling throws InvalidActorNameException when testing long-poll HTTP requests

  20. 20

    Gatling Pass TestCase ChainBuilder Array["TC01","TC02", ...] dynamically to Scenarios

  21. 21

    Load Testing CassandraDB with JMeter

  22. 22

    Spring load testing

  23. 23

    Load or Stress Testing in nodejs

  24. 24

    Load testing a notification hub

  25. 25

    Load or Stress Testing in nodejs

  26. 26

    Error while running unit test cases through Jenkins: Could not load file or assembly 'Microsoft.QualityTools.Testing.Fakes, Version=11.0.0.0'

  27. 27

    Testing advanced scenarios using JMeter Mail Reader sampler

  28. 28

    Gatling load tests and ScalaTest unit tests in same Play project

  29. 29

    gatling load test with three REST APIs with different throughputs

HotTag

Archive