Renaming request during simulation

Hello,

Is there a way to change the name of a request during simulation ? I didn’t found how to do this.
I try composing the name with a var, or with method call. I also try to store it in user session ( like “${name}” )

I need this because during the simulation, conditions are changing, and I need to create a separate entry (so changing the name of request) : otherwise, results are merged.

Cheers,

Denis

Hi Denis,

That’s currently not possible. Let me check if we can do this without it being to risky (have to handle the possibility that the request name computation fails, then).

Have you considered using a doIf or a switch, with different requests?

2012/10/23 DeV@n <vanpeperstraete.d@mipih.fr>

Re,

We made the request names static because they are used for tracking/logging, especially when an exception occur.
If we make them dynamic (a function that takes a Session and returns a String), there’s a chance that this function crashes, so we don’t have the request name, so we can’t log.

As a consequence, I’m quite reluctant changing this, so I’d really like to know more about your use case.

Cheers,

Stéphane

2012/10/23 Stéphane Landelle <slandelle@excilys.com>

Hi Stéphane,

I have tried with a ListBuffer storing exec(http(name).post(…)…) as I have a finite number of request, but with no success.

Our use case in details :
We have an application which test SQL requests. We also have an XML file containing SQL sentences.
We are able to read SQL data from the XML file, with a customFeeder.
The simulation play one SQL, and go for the next, etc. So, I need renaming the request as I mention before, because all my results are merged under the same label.

Can we imagine, if computing the request’s name fails, to fallback to a generic name ?

You have been implementing JDBC support for Gatling?!
Cool! Would you consider contributing it?

Actually, what you’re doing is VERY similar to what I’ve helped Henry Gomez build for testing his maven repositories.
He had a CSV file with the name, groupId and artifactId of the artifacts and wanted to build a scenario from this file.
All his users where playing the same requests.

The scenario looked like this:

val chains = tsv(“fileName”)
.map { record =>
for {
requestName ← record.get(“requestName”)
url ← record.get(“url”)
} yield {
exec(http(requestName).get(url).headers(headers)).pause(extPause)
}
}.flatten

val scn = scenario(“csv-injector”).exec(chains)

Would this suite your needs?

Steph

2012/10/23 DeV@n <vanpeperstraete.d@mipih.fr>

Hi,
I have the same problematic on a scenario.
here’s my use case :

  • Step 1 : i extract with two regex two list, one with the component id and the second with button’s name from a screen that represent a list of different actions the user can click
  • Step 2 : i randomly click on a button, all works fine but i’m unable to know which one was selected in my counters at the end of job

How can i rename the request with the name of the randomly accessed button without using a variable stored in Session ?
It’s important for us to make difference because the response time can vary from a button to another.

Thanks by advance,

Ludovic

Point taken.

You’ll have dynamic names in 1.4.0. In case of an exception in the name resolution, you’ll get a “no-name” or something like that.

You’ll probably have something in master/CI soon, so stay tuned.
Cheers,

Stéphane

2012/10/23 Ludovic Mercier <ludovic.mercier.lm@gmail.com>

Nice !!

By the way I was able to construct many requests with different name, using your trick :

val chains = tsv(“fileName”)
.map { record =>
for {
requestName ← record.get(“requestName”)
url ← record.get(“url”)
} yield {
exec(http(requestName).get(url).headers(headers)).pause(extPause)
}
}.flatten
val scn = scenario(“csv-injector”).exec(chains)

I had to adapt it, but now It works like a charm :slight_smile: Many Thanks !!

Concerning JDBC support, it’s not really that. In fact, our application is based on GWT RPC request. The SQL is passed through the GWT Payload.
So, our customFeeder (which reads from XML file ) fills the session with SQL request, and the .fileBody("…txt", Map(“requete” → “${requete}”)) does the job.

If you are interested, I can post here the customFeeder, even it’s not very complicated and very close to our needs.

Thanks again !
Denis

Here’s the fix:
https://github.com/excilys/gatling/issues/792

Now one can define request names as pure Strings, ELs or (Session => String) functions.

Cheers,

Stéphane

2012/10/23 DeV@n <vanpeperstraete.d@mipih.fr>