Jar gatling project with java arguments

Hello All,

I am trying to generate the jar of my gatling project, I would like to know how to send jvm arguments to the jar, since when I run it with the arguments I get null pointer exception, so I have in my project the variables that I want it to receive via the command line.

public class E11Simulation extends Simulation {

    static String acta = System.getProperty("acta");
    String usuario = System.getProperty("usuario");
    String password = System.getProperty("password");
    int nbUsers = Integer.getInteger("users", 1);
    long myRamp = Long.getLong("ramp", 1);

and this is the result that it shows me in the console

These are the versions I’m using

<gatling.version>3.9.5</gatling.version>
        <maven-jar-plugin.version>3.3.0</maven-jar-plugin.version>
        <gatling-maven-plugin.version>4.5.0</gatling-maven-plugin.version>
        <maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
        <maven-resources-plugin.version>3.3.1</maven-resources-plugin.version>

I Hope can you help me

Hi,

Running example with Maven:

mvn gatling:test -DRAMP_DURATION"="60"

… with in the source code example:

public static final Duration RAMP_DURATION = Duration
			.ofSeconds(Integer.parseInt(System.getProperty("RAMP_DURATION", "1")));

And don’t forget the maven configuration because here the simulation test class is not indicated in the maven command:

<configuration>
	      	  ...
		      <runMultipleSimulations>true</runMultipleSimulations>
			  <includes>
			    <include>simulations.*</include>
			  </includes>
	     </configuration>

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