Parameter that increments for every user?

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

  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.

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

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.

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

MM