Spike Testing in Galting

I want to implement spike test in gatling shown in the image [in the image you can see 9 spikes I want to implement such a way that we can dynamically pass the spikes at run time like if I enter no. of spikes as 5 it should do 5 time spike]

I have tried this approach

scenario.inject(
  rampUsers (10) during (2),
  constantUsersPerSec(10) during (5),
  (1 to 4).flatMap(i => Seq(
    rampUsers(100) during (2),
    constantUsersPerSec(100) during (20),
    rampUsers(10) during (2))
  ),
  constantUsersPerSec(10) during (20),
  rampUsersPerSec(10) to 1 during (2)
).protocols(httpProtocol)

but getting this error

could not find implicit value for evidence parameter of type io.gatling.core.controller.inject.InjectionProfileFactory[Equals]

Basically, what you’re currently doing is like inject(A, A, Seq[A], A, A). This can’t possibly work. You need to concatenate your individual elements and your sequence so you end up with inject(Seq[A]).

could you guide me then how I can replication the spikes shown in images please and for this type of spike testing do we need Gatling enterprise ??

Hi @postmalone,

You are on the right path!
As @slandelle wrote, you have to make a single Seq before giving it to inject.
Look at the way to manipulate Seq and append, prepend what you already have.
To help you, extract the whole content of inject into a val (should be a Seq[...])

Cheers!

How to concatenate Seqs in Scala: How to merge Scala sequential collections (List, Vector, ArrayBuffer, Array, Seq) | alvinalexander.com

Then if this is completely unclear for you, it’s definitely a sign that you should be using Gatling Java instead of Gatling Scala.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.