# Spike Testing in Galting

**URL:** <https://community.gatling.io/t/spike-testing-in-galting/8166>\
**Category:** Gatling (Open-Source)\
**Created:** [August 3, 2023, 9:02am UTC](https://community.gatling.io/t/spike-testing-in-galting/8166 "2023-08-03T09:02:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![postmalone](https://avatars.discourse-cdn.com/v4/letter/p/ba8739/32.png) [@postmalone](https://community.gatling.io/u/postmalone)\
**Post date:** [August 3, 2023, 9:02am UTC](https://community.gatling.io/t/spike-testing-in-galting/8166/1 "2023-08-03T09:02:52Z")

</div>

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]

 ![image-20230725-080818(1)(1)](https://europe1.discourse-cdn.com/flex013/uploads/gatling2/original/2X/7/73245c78b557ad9430efc1c9d0fad10499a1cf51.png)

**I have tried this approach**

```scala
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**

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

```

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [August 3, 2023, 10:18am UTC](https://community.gatling.io/t/spike-testing-in-galting/8166/2 "2023-08-03T10:18:22Z")

</div>

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])`.

---

<div class="post-metadata">

**Author:** ![postmalone](https://avatars.discourse-cdn.com/v4/letter/p/ba8739/32.png) [@postmalone](https://community.gatling.io/u/postmalone)\
**Post date:** [August 4, 2023, 5:15am UTC](https://community.gatling.io/t/spike-testing-in-galting/8166/3 "2023-08-04T05:15:23Z")

</div>

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 ??

---

<div class="post-metadata">

**Author:** ![sbrevet](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/sbrevet/32/830_2.png) [@sbrevet](https://community.gatling.io/u/sbrevet)\
**Post date:** [August 4, 2023, 6:19am UTC](https://community.gatling.io/t/spike-testing-in-galting/8166/4 "2023-08-04T06:19:35Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [August 4, 2023, 7:11am UTC](https://community.gatling.io/t/spike-testing-in-galting/8166/5 "2023-08-04T07:11:21Z")

</div>

How to concatenate Seqs in Scala: [How to merge Scala sequential collections (List, Vector, ArrayBuffer, Array, Seq) | alvinalexander.com](https://alvinalexander.com/scala/how-to-merge-sequences-collections-scala-cookbook/)

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

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex013/uploads/gatling2/original/2X/b/b148e0742de35c6280726cabf3ecd3de2d320f63.png) [@system](https://community.gatling.io/u/system)\
**Post date:** [September 3, 2023, 7:12am UTC](https://community.gatling.io/t/spike-testing-in-galting/8166/6 "2023-09-03T07:12:08Z")

</div>

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