# Parameter that increments for every user?

**URL:** https://community.gatling.io/t/parameter-that-increments-for-every-user/711
**Category:** Gatling (Open-Source)
**Created:** [December 9, 2013, 10:24am UTC](https://community.gatling.io/t/parameter-that-increments-for-every-user/711 "2013-12-09T10:24:19Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Michal\_Michalak](https://avatars.discourse-cdn.com/v4/letter/m/73ab20/32.png) [@Michal\_Michalak](https://community.gatling.io/u/Michal_Michalak)
#### Post date: [December 9, 2013, 10:24am UTC](https://community.gatling.io/t/parameter-that-increments-for-every-user/711/1 "2013-12-09T10:24:19Z")

</div>

Hello

Assume I have scenario like this:

> var index = 1

> val scn3 = scenario(“test”)  
> .exec(jsfGet(“r1: load test”, “/test.xhtml”))  
> .exec(http(“r2: post id”)  
> .post(“/test.xhtml”)  
> .param(“javax.faces.partial.ajax”, “true”)  
> .param(“javax.faces.source”, “frm:btn”)  
> .param(“javax.faces.partial.execute”, “@all”)  
> .param(“frm:btn”, “frm:btn”)  
> .param(“frm”, “frm”)  
> .param(“frm:input”, “test-id-” + index) // \<---------- line (1)  
> .param(“javax.faces.ViewState”, “${viewState}”)  
> )  
> .exec(http(“r3: show id”).get(“/test2.xhtml”).check(regex(“”“test-id-13"”").saveAs(“allPage”))) // \<— line (2)

In line (1) How do I make index variable to increment for each user? I need each user to have his unique id.

In line (2) Right now I am testing for number 13, how do I test for concrete number for my user which is stored in variable index?

Also could anyone please explain to me why do use 3 quotation marks with regex? Why not simple “13”?

Many thanks in advance.

MM

---

<div class="post-metadata">

### Author: ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)
#### Post date: [December 9, 2013, 10:32am UTC](https://community.gatling.io/t/parameter-that-increments-for-every-user/711/2 "2013-12-09T10:32:57Z")

</div>

1. users have a String uuid: session.userId, would this help?

Otherwise:  
val incrementalId = new AtomicInteger

.exec(\_.set(“id”, incrementalId.getAndIncrement))  
…  
.param(“frm:input”, “test-id-${id}”)

1. see above

2. in Scala, triple quotes content is automatically protected: you don’t have to escape special characters, such as \ or ", and can even define multiline strings.

---

<div class="post-metadata">

### Author: ![Michal\_Michalak](https://avatars.discourse-cdn.com/v4/letter/m/73ab20/32.png) [@Michal\_Michalak](https://community.gatling.io/u/Michal_Michalak)
#### Post date: [December 9, 2013, 10:51am UTC](https://community.gatling.io/t/parameter-that-increments-for-every-user/711/3 "2013-12-09T10:51:42Z")

</div>

How do I use session.userId? Is this Session parameter? Should I use “${userId}”?

---

<div class="post-metadata">

### Author: ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)
#### Post date: [December 9, 2013, 11:01am UTC](https://community.gatling.io/t/parameter-that-increments-for-every-user/711/4 "2013-12-09T11:01:18Z")

</div>

userId is not an attribute but a Session class method, so you can only use it programmatically, not with EL.  
I guess setting a custom incremental id is more convenient in your case.

---

<div class="post-metadata">

### Author: ![Michal\_Michalak](https://avatars.discourse-cdn.com/v4/letter/m/73ab20/32.png) [@Michal\_Michalak](https://community.gatling.io/u/Michal_Michalak)
#### Post date: [December 9, 2013, 11:03am UTC](https://community.gatling.io/t/parameter-that-increments-for-every-user/711/5 "2013-12-09T11:03:21Z")

</div>

And 2nd method is working fine. I was just curious.  
Thank you for help.

MM
