Any way to dynamically set the runDescription?

Is there any way to dynamically set the runDescription? The only way I know of to set that description is directly in the gatling.conf file, but it would be very helpful to be able to set that dynamically based on the command line switches.

My scenarios are all controlled by command line switches that govern how many users are used, what environment I’m running against, the ramp times, etc, etc. Being able to see that in the report would be incredibly useful.

The -rd option is meant for this, try gatling.sh -h it will list you all the options that are there.

Thanks. I would much prefer that I be able to do it dynamically in the code. I.e. take the command line params, figure out what they mean for the scenario, and dump that into the description. Doing it at the command line is a bit redundant in my case because I have to specify both the command line params for the run AND the -rd option.

Are you using gatling.sh to run gatling, then best option will be to handled it in your shell script. I see how this can be annoying

If you’ve built you own gatling package then it should be easier for you to set up the run description when you launch that Gatling app.

If you are using the gatling.sh and want to setup the run description programmatically in your code then to best of my understanding you’ll have to modify the code for your needs Gatling class

I’m not sure about this → you may be able to have a wrapper that initializes the Gatling app based on your needs.

I think its a good candidate for a Feature request.

I’m using SBT, not gatling.sh. My real goal is to be able to set that description inside the simulation class I’m running that is then launching the scenarios. I’ll enter a feature request. Thanks for the responses.

Should this be simple as picking the values from the Simulation class and using it in the GatlingPropsBuilder().runDescription(myString) ? Am I missing something here :confused:

I don’t see how this could work. GatlingPropertiesBuilder is just some helper code to take properties and build them into a config that then gets passed to the Gatling class, but that code takes those properties and then runs the simulation. Creating a new GatlingPropertiesBuilder and setting a new runDescription from within my Simulation class isn’t going to do anything.

FWIW, I reached out to the gatling folks at github, and they weren’t too receptive of even the idea of what I wanted to do. Feature Request: Allow for dynamically setting the runDescription in the Simulation · Issue #4384 · gatling/gatling · GitHub

I’m not familiar with SBT but in Maven and Java code you can add parameter
-Dgatling.runDescription="Foo Bar or NOT Bar Foo"
when you run simulation e.g. for Maven:

mvn gatling:test -Dgatling.runDescription="Foo Bar or NOT Bar Foo" -Dgatling.simulationClass=pl.gemiusz.Case0006CommandLineParametersSimu
lation -Dfoo=10 -Dbar=GeMi

Thanks for the reply, but the entire point is not to have to do that. The point is that the descriptive text can and should be derived from the command line args. Having to code that description up AND specify the same things on the command like as args is the duplicate work I’m trying to avoid.

I have one proposition for hack to arhive this feature.
Looking at Gatling Docs → Gatling - Simulation
you can edit first line in simulation.log where is runDescription stored using after hook because is executed before HTML reports are generated.
This shouldn’t be hard to do it :slight_smile: and should work :slight_smile:

Note: simulation.log is an internal, subject to change without notice.

@GeMi That is hacky as hell – and I love it. Works perfectly!

Yes, I recognize that simulation.log is internal, but if the devs refuse to help, we have no choice but to help ourselves.

1 Like

@mikesnare Please understand that we can’t comply with every feature request, in particular when they only serve a purpose for a unique user, don’t match with the existing architecture and a different way to achieve it exists (that is not to your liking, but still).

That being said, please keep in mind that you are requested to keep a nice attitude here.
You are benefiting for free from our hard work, the only acceptable attitude is gratitude.

@mikesnare As another way doing it: having a script (bash?) that take your wanted arguments and give those arguments and a computed one for the runDescription to the original command.

The way you launch the application is your own way.

Cheers!

@slandelle Point taken, and I apologize for the tone. It is an awesome package and I am benefitting from it for free. Many thanks to you all for supporting it.

To be fair, though, your answer in that thread I linked was to point me to the paid solution, close the ticket, and say (paraphrasing) “we won’t do this”. The request itself seems to make perfect sense to me – Why shouldn’t the code be able to alter the description at run time? It’s a testing and reporting solution and there’s no way for the code that runs the test to add a message the report? It does seem a bit odd, doesn’t it?

Show code and mark my post as Solution :slight_smile:

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